Files
govoplan-payments/webui/scripts/test-interface-pattern.mjs
T
zemion a2dcd8f2dd
Module Package Release / publish-packages (push) Successful in 14s
Add guided Payments operator workspace
2026-08-19 13:17:13 +02:00

34 lines
2.5 KiB
JavaScript

import assert from "node:assert/strict";
import { readFileSync } from "node:fs";
import { resolve } from "node:path";
import { fileURLToPath } from "node:url";
const root = resolve(fileURLToPath(new URL("..", import.meta.url)));
const read = (path) => readFileSync(resolve(root, path), "utf8");
const page = read("src/features/payments/PaymentsPage.tsx");
const createDialog = read("src/features/payments/PaymentRequestDialog.tsx");
const reconcileDialog = read("src/features/payments/ManualReconciliationDialog.tsx");
const styles = read("src/styles/payments.css");
assert.match(page, /<WorkspaceFrame/, "Payments uses the central full-height module frame");
assert.match(page, /<PageLayout/, "Payments uses the central headed page frame");
assert.match(page, /<PageActionBar[\s\S]*variant="collection"/, "Payments declares the collection action archetype");
assert.match(page, /reloadAction=/, "Payments provides the required reload slot");
assert.match(page, /createAction=/, "Payments provides the far-right create slot");
assert.match(page, /<MetricGrid/, "Payments summary geometry is centralized");
assert.match(page, /<FilterBar/, "Payments filters use the central bar");
assert.match(page, /<DataGrid/, "Payments rows use the central data grid");
assert.match(page, /<TableActionGroup/, "Payments keeps one stable ordered row action set");
assert.match(page, /disabledReason=/, "permission and state blockers remain actionable");
assert.match(page, /stale/, "refresh failures retain explicit stale-data state");
assert.match(createDialog, /<Dialog[\s\S]*<DialogForm/, "request creation composes central dialog anatomy");
assert.match(createDialog, /useUnsavedDraftGuard/, "request drafts use the shared discard guard");
assert.match(createDialog, /idempotency_key/, "request creation exposes replay protection");
assert.match(reconcileDialog, /<DescriptionList/, "reconciliation presents exact immutable facts semantically");
assert.match(reconcileDialog, /version[\s\S]*checksum/, "reconciliation captures immutable evidence binding");
assert.match(reconcileDialog, /useUnsavedDraftGuard/, "reconciliation drafts use the shared discard guard");
assert.doesNotMatch(styles, /\.page-heading|\.action-toolbar|\.dialog-panel|\.data-grid/, "Payments does not redefine shared page, toolbar, dialog, or table anatomy");
assert.doesNotMatch(`${page}\n${createDialog}\n${reconcileDialog}`, /window\.alert|\balert\s*\(/, "Payments does not use global alerts");
console.log("Payments interface-pattern contracts passed.");