mirror of
https://github.com/nicotsx/zerobyte.git
synced 2026-02-20 07:45:30 -05:00
* 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
29 lines
734 B
TypeScript
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 });
|
|
});
|