final touches for beta skymoney (at least i think)
This commit is contained in:
@@ -9,6 +9,8 @@ process.env.DATABASE_URL =
|
||||
process.env.PORT = process.env.PORT || "0"; // fastify can bind an ephemeral port
|
||||
process.env.HOST ??= "127.0.0.1";
|
||||
process.env.CORS_ORIGIN = process.env.CORS_ORIGIN || "";
|
||||
process.env.AUTH_DISABLED = process.env.AUTH_DISABLED || "1";
|
||||
process.env.SEED_DEFAULT_BUDGET = process.env.SEED_DEFAULT_BUDGET || "1";
|
||||
|
||||
export const prisma = new PrismaClient();
|
||||
|
||||
@@ -25,8 +27,18 @@ export async function resetUser(userId: string) {
|
||||
beforeAll(async () => {
|
||||
// make sure the schema is applied before running tests
|
||||
execSync("npx prisma migrate deploy", { stdio: "inherit" });
|
||||
|
||||
// Ensure a clean slate: wipe all tables to avoid cross-file leakage
|
||||
await prisma.$transaction([
|
||||
prisma.allocation.deleteMany({}),
|
||||
prisma.transaction.deleteMany({}),
|
||||
prisma.incomeEvent.deleteMany({}),
|
||||
prisma.fixedPlan.deleteMany({}),
|
||||
prisma.variableCategory.deleteMany({}),
|
||||
prisma.user.deleteMany({}),
|
||||
]);
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
await prisma.$disconnect();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user