import { describe, it, expect } from "vitest"; import { readFileSync } from "fs"; import { join } from "path"; describe("cleanupStaleData should not reference legacy verifications table", () => { it("should not query verifications table (legacy, no longer written to)", () => { const dbSrc = readFileSync(join(__dirname, "../services/db.ts"), "utf8"); // Extract just the cleanupStaleData function body const funcStart = dbSrc.indexOf("async function cleanupStaleData"); const funcEnd = dbSrc.indexOf("export { pool }"); const funcBody = dbSrc.slice(funcStart, funcEnd); // Should not reference 'verifications' table (only pending_verifications is active) // The old query checked: email NOT IN (SELECT ... FROM verifications WHERE verified_at IS NOT NULL) expect(funcBody).not.toContain("FROM verifications WHERE verified_at"); }); });