mirror of
https://github.com/versia-pub/server.git
synced 2025-12-06 08:28:19 +01:00
refactor: ✅ Only delete old test users once at preload
This commit is contained in:
parent
f5a0f52b93
commit
5b658984a5
|
|
@ -1,2 +1,5 @@
|
||||||
[install.scopes]
|
[install.scopes]
|
||||||
"@jsr" = "https://npm.jsr.io"
|
"@jsr" = "https://npm.jsr.io"
|
||||||
|
|
||||||
|
[test]
|
||||||
|
preload = ["./tests/setup.ts"]
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { drizzle } from "drizzle-orm/node-postgres";
|
import { drizzle } from "drizzle-orm/node-postgres";
|
||||||
import { migrate } from "drizzle-orm/postgres-js/migrator";
|
import { migrate } from "drizzle-orm/postgres-js/migrator";
|
||||||
import { LogLevel, type LogManager, type MultiLogManager } from "log-manager";
|
import { LogLevel, LogManager, type MultiLogManager } from "log-manager";
|
||||||
import { Client } from "pg";
|
import { Client } from "pg";
|
||||||
import { config } from "~/packages/config-manager";
|
import { config } from "~/packages/config-manager";
|
||||||
import * as schema from "./schema";
|
import * as schema from "./schema";
|
||||||
|
|
@ -14,7 +14,7 @@ export const client = new Client({
|
||||||
});
|
});
|
||||||
|
|
||||||
export const setupDatabase = async (
|
export const setupDatabase = async (
|
||||||
logger: LogManager | MultiLogManager,
|
logger: LogManager | MultiLogManager = new LogManager(Bun.stdout),
|
||||||
info = true,
|
info = true,
|
||||||
) => {
|
) => {
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
|
|
@ -4,15 +4,9 @@ import { eq } from "drizzle-orm";
|
||||||
import { db } from "~drizzle/db";
|
import { db } from "~drizzle/db";
|
||||||
import { Applications } from "~drizzle/schema";
|
import { Applications } from "~drizzle/schema";
|
||||||
import { config } from "~packages/config-manager";
|
import { config } from "~packages/config-manager";
|
||||||
import {
|
import { getTestUsers, sendTestRequest } from "~tests/utils";
|
||||||
deleteOldTestUsers,
|
|
||||||
getTestUsers,
|
|
||||||
sendTestRequest,
|
|
||||||
} from "~tests/utils";
|
|
||||||
import { meta } from "./index";
|
import { meta } from "./index";
|
||||||
|
|
||||||
await deleteOldTestUsers();
|
|
||||||
|
|
||||||
const { users, deleteUsers, passwords } = await getTestUsers(1);
|
const { users, deleteUsers, passwords } = await getTestUsers(1);
|
||||||
|
|
||||||
// Create application
|
// Create application
|
||||||
|
|
|
||||||
|
|
@ -4,15 +4,9 @@ import { eq } from "drizzle-orm";
|
||||||
import { db } from "~drizzle/db";
|
import { db } from "~drizzle/db";
|
||||||
import { Applications } from "~drizzle/schema";
|
import { Applications } from "~drizzle/schema";
|
||||||
import { config } from "~packages/config-manager";
|
import { config } from "~packages/config-manager";
|
||||||
import {
|
import { getTestUsers, sendTestRequest } from "~tests/utils";
|
||||||
deleteOldTestUsers,
|
|
||||||
getTestUsers,
|
|
||||||
sendTestRequest,
|
|
||||||
} from "~tests/utils";
|
|
||||||
import { meta } from "./index";
|
import { meta } from "./index";
|
||||||
|
|
||||||
await deleteOldTestUsers();
|
|
||||||
|
|
||||||
const { users, deleteUsers, passwords } = await getTestUsers(1);
|
const { users, deleteUsers, passwords } = await getTestUsers(1);
|
||||||
const token = randomBytes(32).toString("hex");
|
const token = randomBytes(32).toString("hex");
|
||||||
const newPassword = randomBytes(16).toString("hex");
|
const newPassword = randomBytes(16).toString("hex");
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,9 @@
|
||||||
import { afterAll, describe, expect, test } from "bun:test";
|
import { afterAll, describe, expect, test } from "bun:test";
|
||||||
import { config } from "config-manager";
|
import { config } from "config-manager";
|
||||||
import {
|
import { getTestUsers, sendTestRequest } from "~tests/utils";
|
||||||
deleteOldTestUsers,
|
|
||||||
getTestUsers,
|
|
||||||
sendTestRequest,
|
|
||||||
} from "~tests/utils";
|
|
||||||
import type { Relationship as APIRelationship } from "~types/mastodon/relationship";
|
import type { Relationship as APIRelationship } from "~types/mastodon/relationship";
|
||||||
import { meta } from "./block";
|
import { meta } from "./block";
|
||||||
|
|
||||||
await deleteOldTestUsers();
|
|
||||||
|
|
||||||
const { users, tokens, deleteUsers } = await getTestUsers(2);
|
const { users, tokens, deleteUsers } = await getTestUsers(2);
|
||||||
|
|
||||||
afterAll(async () => {
|
afterAll(async () => {
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,9 @@
|
||||||
import { afterAll, describe, expect, test } from "bun:test";
|
import { afterAll, describe, expect, test } from "bun:test";
|
||||||
import { config } from "config-manager";
|
import { config } from "config-manager";
|
||||||
import {
|
import { getTestUsers, sendTestRequest } from "~tests/utils";
|
||||||
deleteOldTestUsers,
|
|
||||||
getTestUsers,
|
|
||||||
sendTestRequest,
|
|
||||||
} from "~tests/utils";
|
|
||||||
import type { Relationship as APIRelationship } from "~types/mastodon/relationship";
|
import type { Relationship as APIRelationship } from "~types/mastodon/relationship";
|
||||||
import { meta } from "./follow";
|
import { meta } from "./follow";
|
||||||
|
|
||||||
await deleteOldTestUsers();
|
|
||||||
|
|
||||||
const { users, tokens, deleteUsers } = await getTestUsers(2);
|
const { users, tokens, deleteUsers } = await getTestUsers(2);
|
||||||
|
|
||||||
afterAll(async () => {
|
afterAll(async () => {
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,9 @@
|
||||||
import { afterAll, beforeAll, describe, expect, test } from "bun:test";
|
import { afterAll, beforeAll, describe, expect, test } from "bun:test";
|
||||||
import { config } from "config-manager";
|
import { config } from "config-manager";
|
||||||
import {
|
import { getTestUsers, sendTestRequest } from "~tests/utils";
|
||||||
deleteOldTestUsers,
|
|
||||||
getTestUsers,
|
|
||||||
sendTestRequest,
|
|
||||||
} from "~tests/utils";
|
|
||||||
import type { Account as APIAccount } from "~types/mastodon/account";
|
import type { Account as APIAccount } from "~types/mastodon/account";
|
||||||
import { meta } from "./followers";
|
import { meta } from "./followers";
|
||||||
|
|
||||||
await deleteOldTestUsers();
|
|
||||||
|
|
||||||
const { users, tokens, deleteUsers } = await getTestUsers(5);
|
const { users, tokens, deleteUsers } = await getTestUsers(5);
|
||||||
|
|
||||||
afterAll(async () => {
|
afterAll(async () => {
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,9 @@
|
||||||
import { afterAll, beforeAll, describe, expect, test } from "bun:test";
|
import { afterAll, beforeAll, describe, expect, test } from "bun:test";
|
||||||
import { config } from "config-manager";
|
import { config } from "config-manager";
|
||||||
import {
|
import { getTestUsers, sendTestRequest } from "~tests/utils";
|
||||||
deleteOldTestUsers,
|
|
||||||
getTestUsers,
|
|
||||||
sendTestRequest,
|
|
||||||
} from "~tests/utils";
|
|
||||||
import type { Account as APIAccount } from "~types/mastodon/account";
|
import type { Account as APIAccount } from "~types/mastodon/account";
|
||||||
import { meta } from "./following";
|
import { meta } from "./following";
|
||||||
|
|
||||||
await deleteOldTestUsers();
|
|
||||||
|
|
||||||
const { users, tokens, deleteUsers } = await getTestUsers(5);
|
const { users, tokens, deleteUsers } = await getTestUsers(5);
|
||||||
|
|
||||||
afterAll(async () => {
|
afterAll(async () => {
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,9 @@
|
||||||
import { afterAll, beforeAll, describe, expect, test } from "bun:test";
|
import { afterAll, beforeAll, describe, expect, test } from "bun:test";
|
||||||
import { config } from "config-manager";
|
import { config } from "config-manager";
|
||||||
import {
|
import { getTestStatuses, getTestUsers, sendTestRequest } from "~tests/utils";
|
||||||
deleteOldTestUsers,
|
|
||||||
getTestStatuses,
|
|
||||||
getTestUsers,
|
|
||||||
sendTestRequest,
|
|
||||||
} from "~tests/utils";
|
|
||||||
import type { Account as APIAccount } from "~types/mastodon/account";
|
import type { Account as APIAccount } from "~types/mastodon/account";
|
||||||
import { meta } from "./index";
|
import { meta } from "./index";
|
||||||
|
|
||||||
await deleteOldTestUsers();
|
|
||||||
|
|
||||||
const { users, tokens, deleteUsers } = await getTestUsers(5);
|
const { users, tokens, deleteUsers } = await getTestUsers(5);
|
||||||
const timeline = (await getTestStatuses(40, users[0])).toReversed();
|
const timeline = (await getTestStatuses(40, users[0])).toReversed();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,9 @@
|
||||||
import { afterAll, describe, expect, test } from "bun:test";
|
import { afterAll, describe, expect, test } from "bun:test";
|
||||||
import { config } from "config-manager";
|
import { config } from "config-manager";
|
||||||
import {
|
import { getTestUsers, sendTestRequest } from "~tests/utils";
|
||||||
deleteOldTestUsers,
|
|
||||||
getTestUsers,
|
|
||||||
sendTestRequest,
|
|
||||||
} from "~tests/utils";
|
|
||||||
import type { Relationship as APIRelationship } from "~types/mastodon/relationship";
|
import type { Relationship as APIRelationship } from "~types/mastodon/relationship";
|
||||||
import { meta } from "./mute";
|
import { meta } from "./mute";
|
||||||
|
|
||||||
await deleteOldTestUsers();
|
|
||||||
|
|
||||||
const { users, tokens, deleteUsers } = await getTestUsers(2);
|
const { users, tokens, deleteUsers } = await getTestUsers(2);
|
||||||
|
|
||||||
afterAll(async () => {
|
afterAll(async () => {
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,9 @@
|
||||||
import { afterAll, beforeAll, describe, expect, test } from "bun:test";
|
import { afterAll, beforeAll, describe, expect, test } from "bun:test";
|
||||||
import { config } from "config-manager";
|
import { config } from "config-manager";
|
||||||
import {
|
import { getTestStatuses, getTestUsers, sendTestRequest } from "~tests/utils";
|
||||||
deleteOldTestUsers,
|
|
||||||
getTestStatuses,
|
|
||||||
getTestUsers,
|
|
||||||
sendTestRequest,
|
|
||||||
} from "~tests/utils";
|
|
||||||
import type { Status as APIStatus } from "~types/mastodon/status";
|
import type { Status as APIStatus } from "~types/mastodon/status";
|
||||||
import { meta } from "./statuses";
|
import { meta } from "./statuses";
|
||||||
|
|
||||||
await deleteOldTestUsers();
|
|
||||||
|
|
||||||
const { users, tokens, deleteUsers } = await getTestUsers(5);
|
const { users, tokens, deleteUsers } = await getTestUsers(5);
|
||||||
const timeline = (await getTestStatuses(40, users[1])).toReversed();
|
const timeline = (await getTestStatuses(40, users[1])).toReversed();
|
||||||
const timeline2 = (await getTestStatuses(40, users[2])).toReversed();
|
const timeline2 = (await getTestStatuses(40, users[2])).toReversed();
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,9 @@
|
||||||
import { afterAll, beforeAll, describe, expect, test } from "bun:test";
|
import { afterAll, beforeAll, describe, expect, test } from "bun:test";
|
||||||
import { config } from "config-manager";
|
import { config } from "config-manager";
|
||||||
import {
|
import { getTestUsers, sendTestRequest } from "~tests/utils";
|
||||||
deleteOldTestUsers,
|
|
||||||
getTestUsers,
|
|
||||||
sendTestRequest,
|
|
||||||
} from "~tests/utils";
|
|
||||||
import type { Relationship as APIRelationship } from "~types/mastodon/relationship";
|
import type { Relationship as APIRelationship } from "~types/mastodon/relationship";
|
||||||
import { meta } from "./unmute";
|
import { meta } from "./unmute";
|
||||||
|
|
||||||
await deleteOldTestUsers();
|
|
||||||
|
|
||||||
const { users, tokens, deleteUsers } = await getTestUsers(2);
|
const { users, tokens, deleteUsers } = await getTestUsers(2);
|
||||||
|
|
||||||
afterAll(async () => {
|
afterAll(async () => {
|
||||||
|
|
|
||||||
|
|
@ -11,12 +11,7 @@ import { config } from "config-manager";
|
||||||
import { eq } from "drizzle-orm";
|
import { eq } from "drizzle-orm";
|
||||||
import { db } from "~drizzle/db";
|
import { db } from "~drizzle/db";
|
||||||
import { Users } from "~drizzle/schema";
|
import { Users } from "~drizzle/schema";
|
||||||
import {
|
import { getTestStatuses, getTestUsers, sendTestRequest } from "~tests/utils";
|
||||||
deleteOldTestUsers,
|
|
||||||
getTestStatuses,
|
|
||||||
getTestUsers,
|
|
||||||
sendTestRequest,
|
|
||||||
} from "~tests/utils";
|
|
||||||
import type { Account as APIAccount } from "~types/mastodon/account";
|
import type { Account as APIAccount } from "~types/mastodon/account";
|
||||||
import { meta } from "./index";
|
import { meta } from "./index";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,9 @@
|
||||||
import { afterAll, describe, expect, test } from "bun:test";
|
import { afterAll, describe, expect, test } from "bun:test";
|
||||||
import { config } from "config-manager";
|
import { config } from "config-manager";
|
||||||
import {
|
import { getTestUsers, sendTestRequest } from "~tests/utils";
|
||||||
deleteOldTestUsers,
|
|
||||||
getTestUsers,
|
|
||||||
sendTestRequest,
|
|
||||||
} from "~tests/utils";
|
|
||||||
import type { Account as APIAccount } from "~types/mastodon/account";
|
import type { Account as APIAccount } from "~types/mastodon/account";
|
||||||
import { meta } from "./index";
|
import { meta } from "./index";
|
||||||
|
|
||||||
await deleteOldTestUsers();
|
|
||||||
|
|
||||||
const { users, tokens, deleteUsers } = await getTestUsers(5);
|
const { users, tokens, deleteUsers } = await getTestUsers(5);
|
||||||
|
|
||||||
afterAll(async () => {
|
afterAll(async () => {
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,9 @@
|
||||||
import { afterAll, describe, expect, test } from "bun:test";
|
import { afterAll, describe, expect, test } from "bun:test";
|
||||||
import { config } from "config-manager";
|
import { config } from "config-manager";
|
||||||
import {
|
import { getTestUsers, sendTestRequest } from "~tests/utils";
|
||||||
deleteOldTestUsers,
|
|
||||||
getTestUsers,
|
|
||||||
sendTestRequest,
|
|
||||||
} from "~tests/utils";
|
|
||||||
import type { Account as APIAccount } from "~types/mastodon/account";
|
import type { Account as APIAccount } from "~types/mastodon/account";
|
||||||
import { meta } from "./index";
|
import { meta } from "./index";
|
||||||
|
|
||||||
await deleteOldTestUsers();
|
|
||||||
|
|
||||||
const { users, tokens, deleteUsers } = await getTestUsers(5);
|
const { users, tokens, deleteUsers } = await getTestUsers(5);
|
||||||
|
|
||||||
afterAll(async () => {
|
afterAll(async () => {
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,8 @@
|
||||||
import { afterAll, beforeAll, describe, expect, test } from "bun:test";
|
import { afterAll, describe, expect, test } from "bun:test";
|
||||||
import { config } from "config-manager";
|
import { config } from "config-manager";
|
||||||
import {
|
import { getTestStatuses, getTestUsers, sendTestRequest } from "~tests/utils";
|
||||||
deleteOldTestUsers,
|
|
||||||
getTestStatuses,
|
|
||||||
getTestUsers,
|
|
||||||
sendTestRequest,
|
|
||||||
} from "~tests/utils";
|
|
||||||
import { meta } from "./index";
|
import { meta } from "./index";
|
||||||
|
|
||||||
await deleteOldTestUsers();
|
|
||||||
|
|
||||||
const { users, tokens, deleteUsers } = await getTestUsers(1);
|
const { users, tokens, deleteUsers } = await getTestUsers(1);
|
||||||
const timeline = await getTestStatuses(10, users[0]);
|
const timeline = await getTestStatuses(10, users[0]);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,8 @@
|
||||||
import { afterAll, beforeAll, describe, expect, test } from "bun:test";
|
import { afterAll, beforeAll, describe, expect, test } from "bun:test";
|
||||||
import { config } from "config-manager";
|
import { config } from "config-manager";
|
||||||
import {
|
import { getTestUsers, sendTestRequest } from "~tests/utils";
|
||||||
deleteOldTestUsers,
|
|
||||||
getTestUsers,
|
|
||||||
sendTestRequest,
|
|
||||||
} from "~tests/utils";
|
|
||||||
import { meta } from "./index";
|
import { meta } from "./index";
|
||||||
|
|
||||||
await deleteOldTestUsers();
|
|
||||||
|
|
||||||
const { users, tokens, deleteUsers } = await getTestUsers(3);
|
const { users, tokens, deleteUsers } = await getTestUsers(3);
|
||||||
|
|
||||||
afterAll(async () => {
|
afterAll(async () => {
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,9 @@
|
||||||
import { afterAll, beforeAll, describe, expect, test } from "bun:test";
|
import { afterAll, beforeAll, describe, expect, test } from "bun:test";
|
||||||
import { config } from "config-manager";
|
import { config } from "config-manager";
|
||||||
import {
|
import { getTestUsers, sendTestRequest } from "~tests/utils";
|
||||||
deleteOldTestUsers,
|
|
||||||
getTestUsers,
|
|
||||||
sendTestRequest,
|
|
||||||
} from "~tests/utils";
|
|
||||||
import type { Notification as APINotification } from "~types/mastodon/notification";
|
import type { Notification as APINotification } from "~types/mastodon/notification";
|
||||||
import { meta } from "./dismiss";
|
import { meta } from "./dismiss";
|
||||||
|
|
||||||
await deleteOldTestUsers();
|
|
||||||
|
|
||||||
const { users, tokens, deleteUsers } = await getTestUsers(2);
|
const { users, tokens, deleteUsers } = await getTestUsers(2);
|
||||||
let notifications: APINotification[] = [];
|
let notifications: APINotification[] = [];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,9 @@
|
||||||
import { afterAll, beforeAll, describe, expect, test } from "bun:test";
|
import { afterAll, beforeAll, describe, expect, test } from "bun:test";
|
||||||
import { config } from "config-manager";
|
import { config } from "config-manager";
|
||||||
import {
|
import { getTestUsers, sendTestRequest } from "~tests/utils";
|
||||||
deleteOldTestUsers,
|
|
||||||
getTestUsers,
|
|
||||||
sendTestRequest,
|
|
||||||
} from "~tests/utils";
|
|
||||||
import type { Notification as APINotification } from "~types/mastodon/notification";
|
import type { Notification as APINotification } from "~types/mastodon/notification";
|
||||||
import { meta } from "./index";
|
import { meta } from "./index";
|
||||||
|
|
||||||
await deleteOldTestUsers();
|
|
||||||
|
|
||||||
const { users, tokens, deleteUsers } = await getTestUsers(2);
|
const { users, tokens, deleteUsers } = await getTestUsers(2);
|
||||||
let notifications: APINotification[] = [];
|
let notifications: APINotification[] = [];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,9 @@
|
||||||
import { afterAll, beforeAll, describe, expect, test } from "bun:test";
|
import { afterAll, beforeAll, describe, expect, test } from "bun:test";
|
||||||
import { config } from "config-manager";
|
import { config } from "config-manager";
|
||||||
import {
|
import { getTestUsers, sendTestRequest } from "~tests/utils";
|
||||||
deleteOldTestUsers,
|
|
||||||
getTestUsers,
|
|
||||||
sendTestRequest,
|
|
||||||
} from "~tests/utils";
|
|
||||||
import type { Notification as APINotification } from "~types/mastodon/notification";
|
import type { Notification as APINotification } from "~types/mastodon/notification";
|
||||||
import { meta } from "./index";
|
import { meta } from "./index";
|
||||||
|
|
||||||
await deleteOldTestUsers();
|
|
||||||
|
|
||||||
const { users, tokens, deleteUsers } = await getTestUsers(2);
|
const { users, tokens, deleteUsers } = await getTestUsers(2);
|
||||||
let notifications: APINotification[] = [];
|
let notifications: APINotification[] = [];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,9 @@
|
||||||
import { afterAll, beforeAll, describe, expect, test } from "bun:test";
|
import { afterAll, beforeAll, describe, expect, test } from "bun:test";
|
||||||
import { config } from "config-manager";
|
import { config } from "config-manager";
|
||||||
import {
|
import { getTestStatuses, getTestUsers, sendTestRequest } from "~tests/utils";
|
||||||
deleteOldTestUsers,
|
|
||||||
getTestStatuses,
|
|
||||||
getTestUsers,
|
|
||||||
sendTestRequest,
|
|
||||||
} from "~tests/utils";
|
|
||||||
import type { Notification as APINotification } from "~types/mastodon/notification";
|
import type { Notification as APINotification } from "~types/mastodon/notification";
|
||||||
import { meta } from "./index";
|
import { meta } from "./index";
|
||||||
|
|
||||||
await deleteOldTestUsers();
|
|
||||||
|
|
||||||
const { users, tokens, deleteUsers } = await getTestUsers(2);
|
const { users, tokens, deleteUsers } = await getTestUsers(2);
|
||||||
const statuses = await getTestStatuses(40, users[0]);
|
const statuses = await getTestStatuses(40, users[0]);
|
||||||
let notifications: APINotification[] = [];
|
let notifications: APINotification[] = [];
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,9 @@
|
||||||
import { afterAll, beforeAll, describe, expect, test } from "bun:test";
|
import { afterAll, beforeAll, describe, expect, test } from "bun:test";
|
||||||
import { config } from "config-manager";
|
import { config } from "config-manager";
|
||||||
import {
|
import { getTestStatuses, getTestUsers, sendTestRequest } from "~tests/utils";
|
||||||
deleteOldTestUsers,
|
|
||||||
getTestStatuses,
|
|
||||||
getTestUsers,
|
|
||||||
sendTestRequest,
|
|
||||||
} from "~tests/utils";
|
|
||||||
import type { Notification as APINotification } from "~types/mastodon/notification";
|
import type { Notification as APINotification } from "~types/mastodon/notification";
|
||||||
import { meta } from "./index";
|
import { meta } from "./index";
|
||||||
|
|
||||||
await deleteOldTestUsers();
|
|
||||||
|
|
||||||
const getFormData = (object: Record<string, string | number | boolean>) =>
|
const getFormData = (object: Record<string, string | number | boolean>) =>
|
||||||
Object.keys(object).reduce((formData, key) => {
|
Object.keys(object).reduce((formData, key) => {
|
||||||
formData.append(key, String(object[key]));
|
formData.append(key, String(object[key]));
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,8 @@
|
||||||
import { afterAll, describe, expect, test } from "bun:test";
|
import { afterAll, describe, expect, test } from "bun:test";
|
||||||
import { config } from "~packages/config-manager";
|
import { config } from "~packages/config-manager";
|
||||||
import {
|
import { getTestUsers, sendTestRequest } from "~tests/utils";
|
||||||
deleteOldTestUsers,
|
|
||||||
getTestUsers,
|
|
||||||
sendTestRequest,
|
|
||||||
} from "~tests/utils";
|
|
||||||
import { meta } from "./index";
|
import { meta } from "./index";
|
||||||
|
|
||||||
await deleteOldTestUsers();
|
|
||||||
|
|
||||||
const { deleteUsers, tokens } = await getTestUsers(1);
|
const { deleteUsers, tokens } = await getTestUsers(1);
|
||||||
|
|
||||||
afterAll(async () => {
|
afterAll(async () => {
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,8 @@
|
||||||
import { afterAll, describe, expect, test } from "bun:test";
|
import { afterAll, describe, expect, test } from "bun:test";
|
||||||
import { config } from "~packages/config-manager";
|
import { config } from "~packages/config-manager";
|
||||||
import {
|
import { getTestUsers, sendTestRequest } from "~tests/utils";
|
||||||
deleteOldTestUsers,
|
|
||||||
getTestUsers,
|
|
||||||
sendTestRequest,
|
|
||||||
} from "~tests/utils";
|
|
||||||
import { meta } from "./index";
|
import { meta } from "./index";
|
||||||
|
|
||||||
await deleteOldTestUsers();
|
|
||||||
|
|
||||||
const { deleteUsers, tokens } = await getTestUsers(1);
|
const { deleteUsers, tokens } = await getTestUsers(1);
|
||||||
|
|
||||||
afterAll(async () => {
|
afterAll(async () => {
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,9 @@
|
||||||
import { afterAll, beforeAll, describe, expect, test } from "bun:test";
|
import { afterAll, beforeAll, describe, expect, test } from "bun:test";
|
||||||
import { config } from "config-manager";
|
import { config } from "config-manager";
|
||||||
import {
|
import { getTestStatuses, getTestUsers, sendTestRequest } from "~tests/utils";
|
||||||
deleteOldTestUsers,
|
|
||||||
getTestStatuses,
|
|
||||||
getTestUsers,
|
|
||||||
sendTestRequest,
|
|
||||||
} from "~tests/utils";
|
|
||||||
import type { Account as APIAccount } from "~types/mastodon/account";
|
import type { Account as APIAccount } from "~types/mastodon/account";
|
||||||
import { meta } from "./favourited_by";
|
import { meta } from "./favourited_by";
|
||||||
|
|
||||||
await deleteOldTestUsers();
|
|
||||||
|
|
||||||
const { users, tokens, deleteUsers } = await getTestUsers(5);
|
const { users, tokens, deleteUsers } = await getTestUsers(5);
|
||||||
const timeline = (await getTestStatuses(40, users[0])).toReversed();
|
const timeline = (await getTestStatuses(40, users[0])).toReversed();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,9 @@
|
||||||
import { afterAll, beforeAll, describe, expect, test } from "bun:test";
|
import { afterAll, beforeAll, describe, expect, test } from "bun:test";
|
||||||
import { config } from "config-manager";
|
import { config } from "config-manager";
|
||||||
import {
|
import { getTestStatuses, getTestUsers, sendTestRequest } from "~tests/utils";
|
||||||
deleteOldTestUsers,
|
|
||||||
getTestStatuses,
|
|
||||||
getTestUsers,
|
|
||||||
sendTestRequest,
|
|
||||||
} from "~tests/utils";
|
|
||||||
import type { Account as APIAccount } from "~types/mastodon/account";
|
import type { Account as APIAccount } from "~types/mastodon/account";
|
||||||
import { meta } from "./reblogged_by";
|
import { meta } from "./reblogged_by";
|
||||||
|
|
||||||
await deleteOldTestUsers();
|
|
||||||
|
|
||||||
const { users, tokens, deleteUsers } = await getTestUsers(5);
|
const { users, tokens, deleteUsers } = await getTestUsers(5);
|
||||||
const timeline = (await getTestStatuses(40, users[0])).toReversed();
|
const timeline = (await getTestStatuses(40, users[0])).toReversed();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,16 +3,10 @@ import { config } from "config-manager";
|
||||||
import { eq } from "drizzle-orm";
|
import { eq } from "drizzle-orm";
|
||||||
import { db } from "~drizzle/db";
|
import { db } from "~drizzle/db";
|
||||||
import { Emojis } from "~drizzle/schema";
|
import { Emojis } from "~drizzle/schema";
|
||||||
import {
|
import { getTestUsers, sendTestRequest } from "~tests/utils";
|
||||||
deleteOldTestUsers,
|
|
||||||
getTestUsers,
|
|
||||||
sendTestRequest,
|
|
||||||
} from "~tests/utils";
|
|
||||||
import type { Status as APIStatus } from "~types/mastodon/status";
|
import type { Status as APIStatus } from "~types/mastodon/status";
|
||||||
import { meta } from "./index";
|
import { meta } from "./index";
|
||||||
|
|
||||||
await deleteOldTestUsers();
|
|
||||||
|
|
||||||
const { users, tokens, deleteUsers } = await getTestUsers(5);
|
const { users, tokens, deleteUsers } = await getTestUsers(5);
|
||||||
|
|
||||||
afterAll(async () => {
|
afterAll(async () => {
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,9 @@
|
||||||
import { afterAll, describe, expect, test } from "bun:test";
|
import { afterAll, describe, expect, test } from "bun:test";
|
||||||
import { config } from "config-manager";
|
import { config } from "config-manager";
|
||||||
import {
|
import { getTestStatuses, getTestUsers, sendTestRequest } from "~tests/utils";
|
||||||
deleteOldTestUsers,
|
|
||||||
getTestStatuses,
|
|
||||||
getTestUsers,
|
|
||||||
sendTestRequest,
|
|
||||||
} from "~tests/utils";
|
|
||||||
import type { Status as APIStatus } from "~types/mastodon/status";
|
import type { Status as APIStatus } from "~types/mastodon/status";
|
||||||
import { meta } from "./home";
|
import { meta } from "./home";
|
||||||
|
|
||||||
await deleteOldTestUsers();
|
|
||||||
|
|
||||||
const { users, tokens, deleteUsers } = await getTestUsers(5);
|
const { users, tokens, deleteUsers } = await getTestUsers(5);
|
||||||
const timeline = (await getTestStatuses(40, users[0])).toReversed();
|
const timeline = (await getTestStatuses(40, users[0])).toReversed();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,9 @@
|
||||||
import { afterAll, describe, expect, test } from "bun:test";
|
import { afterAll, describe, expect, test } from "bun:test";
|
||||||
import { config } from "config-manager";
|
import { config } from "config-manager";
|
||||||
import {
|
import { getTestStatuses, getTestUsers, sendTestRequest } from "~tests/utils";
|
||||||
deleteOldTestUsers,
|
|
||||||
getTestStatuses,
|
|
||||||
getTestUsers,
|
|
||||||
sendTestRequest,
|
|
||||||
} from "~tests/utils";
|
|
||||||
import type { Status as APIStatus } from "~types/mastodon/status";
|
import type { Status as APIStatus } from "~types/mastodon/status";
|
||||||
import { meta } from "./public";
|
import { meta } from "./public";
|
||||||
|
|
||||||
await deleteOldTestUsers();
|
|
||||||
|
|
||||||
const { users, tokens, deleteUsers } = await getTestUsers(5);
|
const { users, tokens, deleteUsers } = await getTestUsers(5);
|
||||||
const timeline = (await getTestStatuses(40, users[0])).toReversed();
|
const timeline = (await getTestStatuses(40, users[0])).toReversed();
|
||||||
|
|
||||||
|
|
|
||||||
5
tests/setup.ts
Normal file
5
tests/setup.ts
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
import { setupDatabase } from "~drizzle/db";
|
||||||
|
import { deleteOldTestUsers } from "./utils";
|
||||||
|
|
||||||
|
await setupDatabase();
|
||||||
|
await deleteOldTestUsers();
|
||||||
Loading…
Reference in a new issue