import assert from "node:assert/strict"; import fs from "node:fs"; import path from "node:path"; import test from "node:test"; const resultSource = fs.readFileSync(path.resolve("lib/validation-result.tsx"), "utf8"); const dashboardSource = fs.readFileSync(path.resolve("app/(app)/dashboard/page.tsx"), "utf8"); const validationsSource = fs.readFileSync(path.resolve("app/(app)/validations/page.tsx"), "utf8"); const editorSource = fs.readFileSync(path.resolve("components/validations/validation-editor.tsx"), "utf8"); test("central validation result mapping covers supported values and colors", () => { for (const value of ["BESTANDEN", "BESTANDEN_MIT_AUFLAGEN", "NICHT_BESTANDEN", "OFFEN"]) { assert.match(resultSource, new RegExp(value)); } for (const label of ["Bestanden", "Bestanden mit Auflagen", "Nicht bestanden", "Noch nicht bewertet"]) { assert.match(resultSource, new RegExp(label)); } for (const token of ["bg-success", "bg-warning", "bg-danger", "bg-slate"]) { assert.match(resultSource, new RegExp(token)); } }); test("validations overview renders result badge from central mapping", () => { assert.match(validationsSource, /ValidationResultBadge/); assert.match(validationsSource, /validationResultValues\.map/); assert.doesNotMatch(validationsSource, /