Files
sendou.ink/app/test-setup.ts
Kalle 0a4518a0e2
Some checks failed
E2E Tests / e2e (push) Has been cancelled
Tests and checks on push / run-checks-and-tests (push) Has been cancelled
Updates translation progress / update-translation-progress-issue (push) Has been cancelled
Tournament multi step + grouped and early end SE/DE (#3449)
2026-10-09 18:38:25 +03:00

24 lines
685 B
TypeScript

import { afterEach, vi } from "vitest";
import { isDatabaseDirty } from "~/db/write-tracker";
// wipes the database after any test that wrote to it; the dynamic import keeps
// tests that never touch the database from opening the connection
afterEach(async () => {
if (!isDatabaseDirty()) return;
const { dbReset } = await import("~/db/reset");
await dbReset();
}, 30_000);
// avoids a "Cannot find module '@aws-sdk/core/dist-es/submodules/client/index'" error, delete if tests pass without
vi.mock("@aws-sdk/client-s3", () => ({
S3: vi.fn(() => ({})),
}));
vi.mock("@aws-sdk/lib-storage", () => ({
Upload: vi.fn(() => ({
done: vi.fn(() => Promise.resolve({})),
})),
}));