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

40 lines
1.7 KiB
JavaScript

import assert from "node:assert/strict";
import { readFileSync } from "node:fs";
import { resolve } from "node:path";
const root = resolve(import.meta.dirname, "..");
const read = (path) => readFileSync(resolve(root, path), "utf8");
const overview = read("src/features/admin/AdminOverviewPanel.tsx");
const settings = read("src/features/admin/SystemSettingsPanel.tsx");
const changes = read("src/features/admin/ConfigurationChangesPanel.tsx");
const packages = read("src/features/admin/ConfigurationPackagesPanel.tsx");
const templates = read("src/features/admin/GovernanceTemplatesPanel.tsx");
const modules = read("src/features/admin/ModuleManagementPanel.tsx");
const moduleSource = read("src/module.ts");
const allSource = [overview, settings, changes, packages, templates, modules].join("\n");
for (const source of [overview, settings, changes, packages, templates, modules]) {
assert.match(source, /AdminPageLayout/);
assert.match(source, /DocumentationHelpLink/);
assert.match(source, /disabledReason|help=/);
}
for (const source of [changes, packages, templates, modules]) {
assert.match(source, /ConfirmDialog/);
}
assert.match(changes, /DataGrid/);
assert.match(packages, /ReferenceSelect/);
assert.match(packages, /manualReferences/);
assert.match(templates, /TableActionGroup/);
assert.match(modules, /StageRail/);
assert.match(modules, /ActionBlockerHint/);
assert.match(moduleSource, /version: "0\.1\.8"/);
assert.doesNotMatch(overview, /title="(?:ADMINISTRATION|GLOBAL|TENANT|GROUP|USER)"/);
assert.doesNotMatch(allSource, /window\.(alert|confirm|prompt)\s*\(/);
assert.doesNotMatch(allSource, /@govoplan\/(?!core-webui)[^"']+-webui\//);
console.log("Admin interface pattern-language checks passed.");