docfast/src/__tests__/cleanup-no-verifications-table.test.ts
Hoid 7206cb518d
All checks were successful
Build & Deploy to Staging / Build & Deploy to Staging (push) Successful in 18m37s
Remove dead signup router, unused verification functions, and legacy cleanup query
- Delete src/routes/signup.ts (dead code, 410 handler in index.ts remains)
- Remove isEmailVerified() and getVerifiedApiKey() from verification.ts (only used by signup)
- Remove stale-key cleanup from cleanupStaleData() that queried legacy verifications table
- Update usage middleware message: 'Free tier limit' → 'Account limit'
- TDD: 8 new tests, removed signup.test.ts (dead), net 556 tests passing
2026-03-08 14:07:50 +01:00

16 lines
874 B
TypeScript

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");
});
});