import { prisma } from "../src/db/prisma.js"; import { seedReferenceData } from "../src/db/reference-seed-data.js"; // Single TRUNCATE ... CASCADE covers FK ordering and resets identity // sequences — used between tests/scenarios to start from a clean slate. // Re-seeds the Diet/Category/Allergy reference data right after truncating // it, so every test starts from the same realistic reference data the real // app seeds (`prisma/seed.ts`) rather than empty tables — tests exercising // dietId/allergyIds need real rows to reference. export async function resetDatabase() { await prisma.$executeRawUnsafe(` TRUNCATE TABLE "user_profile_allergy", "user_preference", "allergy", "category", "planning_item", "planning", "recipe_ingredient", "step", "tech_step_mapping", "tech_step", "recipe", "ingredients", "sources", "user_profiles", "diet", "house" RESTART IDENTITY CASCADE; `); await seedReferenceData(prisma); }