import assert from "node:assert/strict"; import { describe, it } from "vitest"; import { gates, shellCommand } from "./verify-auth-api-body-baseline.mjs"; const requiredTestPaths = [ "apps/api/src/auth.test.ts", "apps/api/src/app.test.ts", "apps/api/src/middleware/body-limit.test.ts", "apps/api/src/middleware/request-id.test.ts", "apps/web/app/routes/session-entry.host-aware.test.ts", "root.theme-preference.test.tsx", ]; const forbiddenCommandPatterns = [/playwright/i, /cypress/i, /test:e2e/i, /^pnpm test$/i]; describe("verify-auth-api-body-baseline", () => { it("defines a focused non-watch auth/API/body-limit baseline inventory", () => { assert.deepEqual( gates.map((gate) => [gate.label, gate.command, gate.args]), [ ["TypeScript/static health", "pnpm", ["run", "typecheck"]], [ "Focused auth/API/body-limit Vitest surfaces", "pnpm", ["exec", "vitest", "run", ...requiredTestPaths], ], ], ); }); it("keeps the command inventory non-E2E and non-browser", () => { const commandText = gates.map((gate) => shellCommand(gate)).join("\n"); for (const forbiddenPattern of forbiddenCommandPatterns) { assert.doesNotMatch(commandText, forbiddenPattern); } }); it("includes the Auth API Body-relevant auth, API, request-id, and body-limit test paths", () => { const commandText = gates.map((gate) => shellCommand(gate)).join("\n"); for (const testPath of requiredTestPaths) { assert.match(commandText, new RegExp(testPath.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"))); } }); });