Files
govoplan-audit/webui/scripts/test-interface-pattern-language.mjs
T

30 lines
1.4 KiB
JavaScript

import assert from "node:assert/strict";
import { readFileSync } from "node:fs";
import { fileURLToPath } from "node:url";
const panel = readFileSync(
fileURLToPath(new URL("../src/features/audit/AdminAuditPanel.tsx", import.meta.url)),
"utf8"
);
const moduleSource = readFileSync(
fileURLToPath(new URL("../src/module.ts", import.meta.url)),
"utf8"
);
assert.match(panel, /AdminPageLayout,[\s\S]*DataGrid,[\s\S]*Dialog,[\s\S]*DocumentationHelpLink,[\s\S]*TableActionGroup/);
assert.match(panel, /topicId: "audit\.read-authorized-evidence"/);
assert.match(panel, /disabledReason=\{loading \? I18N\.loading : undefined\}/);
assert.match(panel, /pagination=\{\{[\s\S]*mode: "server"/);
assert.match(panel, /id="admin-audit-event-details-grid"/);
assert.match(panel, /auditDetailRows\(selected\?\.details \?\? \{\}\)/);
assert.match(panel, /emptyText=\{I18N\.noRecords\}/);
assert.doesNotMatch(panel, /<pre|window\.(?:alert|confirm)\(/);
assert.doesNotMatch(panel, /@govoplan\/(?:access|admin)-webui|govoplan_(?:access|admin)/);
assert.match(moduleSource, /generatedTranslations/);
assert.match(moduleSource, /translations,/);
assert.match(moduleSource, /surfaceId: "audit\.admin\.system"[\s\S]*allOf: \["system:audit:read"\]/);
assert.match(moduleSource, /surfaceId: "audit\.admin\.tenant"[\s\S]*allOf: \["audit:read"\]/);
console.log("Audit administration surfaces satisfy the monitoring and evidence pattern contracts.");