Files
zerobyte/app/test/setup.ts
Nico a4fbe3c8df remove proxy pattern in db and auth (#513)
* refactor: add nitro bootstrap plugin to ensure app is started before first call

* refactor(bootstrap): avoid duplicate event firing

* refactor: extract common setup in initModule function

* refactor: remove proxy pattern for db and auth

Since we migrated away from rr this is not needed anymore as the bundler
correctly split chunks
2026-02-13 21:18:40 +01:00

29 lines
734 B
TypeScript

import { beforeAll, mock } from "bun:test";
import { migrate } from "drizzle-orm/bun-sqlite/migrator";
import path from "node:path";
import { cwd } from "node:process";
import { db } from "~/server/db/db";
void mock.module("~/server/utils/logger", () => ({
logger: {
debug: () => {},
info: () => {},
warn: () => {},
error: () => {},
},
}));
void mock.module("~/server/utils/crypto", () => ({
cryptoUtils: {
deriveSecret: async () => "test-secret",
sealSecret: async (v: string) => v,
resolveSecret: async (v: string) => v,
generateResticPassword: () => "test-restic-password",
},
}));
beforeAll(async () => {
const migrationsFolder = path.join(cwd(), "app", "drizzle");
migrate(db, { migrationsFolder });
});