Files
govoplan-reporting/webui/scripts/test-interface-pattern.mjs

23 lines
1.7 KiB
JavaScript

import assert from "node:assert/strict";
import fs from "node:fs";
const page = fs.readFileSync("src/features/reporting/ReportingPage.tsx", "utf8");
const provider = fs.readFileSync("src/features/reporting/ProviderReportWorkspace.tsx", "utf8");
const styles = fs.readFileSync("src/styles/reporting.css", "utf8");
assert.ok(page.includes("DocumentationHelpLink"), "Reporting exposes configured-system help");
assert.ok(page.includes("PageScrollViewport"), "Reporting owns bounded catalogue and inspector scrolling");
assert.ok(page.includes("DataGrid"), "Tabular report results use the shared grid");
assert.ok(page.includes("<Dialog"), "Save and schedule operations use shared dialogs");
assert.ok(page.includes("createDrillContext"), "Aggregate detail uses an actor-bound drill context");
assert.match(page, /id: "drill",\s*header: "Detail",\s*columnType: "actions",\s*sticky: "end"/, "Result drill-down controls use the shared pinned action-column contract");
assert.match(page, /<TableActionGroup actions=\{\[\{\s*id: "drill"/, "Drill-down renders the shared measurable action surface");
assert.ok(page.includes("AccessExplanation"), "Policy-hidden fields, rows, and actions are explained");
assert.ok(page.includes("PublishDialog"), "Publication targets use the shared dialog surface");
assert.ok(provider.includes("disabledReason={runDisabledReason}"), "Governed report blockers remain keyboard-explainable");
assert.ok(provider.includes("DismissibleAlert"), "Provider failures and unavailable states use shared alerts");
assert.ok(!page.includes("window.alert("), "Reporting must not use browser alerts");
assert.ok(styles.includes("@media (max-width: 760px)"), "Reporting retains a narrow-viewport task order");
console.log("Reporting interface pattern contract passed.");