30 lines
2.3 KiB
JavaScript
30 lines
2.3 KiB
JavaScript
import assert from "node:assert/strict";
|
|
import { readFileSync } from "node:fs";
|
|
import { resolve } from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
|
|
const webuiRoot = resolve(fileURLToPath(new URL("..", import.meta.url)));
|
|
const panel = readFileSync(resolve(webuiRoot, "src/features/policy/RetentionPoliciesPanel.tsx"), "utf8");
|
|
const viewPanel = readFileSync(resolve(webuiRoot, "src/features/policy/ViewPoliciesPanel.tsx"), "utf8");
|
|
|
|
assert.match(panel, /<RetentionPolicyScopeManager/, "Policy delegates effective-policy blockers and provenance to the shared Core contract");
|
|
assert.match(panel, /contextId: "policy\.retention"/, "retention exposes stable contextual documentation");
|
|
assert.match(panel, /policy\.retention\.action\.dry-run/, "retention dry runs expose exact contextual help");
|
|
assert.match(panel, /policy\.retention\.action\.apply/, "destructive retention exposes exact contextual help");
|
|
assert.match(panel, /policy\.retention\.confirm-apply/, "retention confirmation exposes consequence and recovery help");
|
|
assert.match(panel, /helpModuleId="policy"/, "retention confirmation retains Policy as its documentation owner");
|
|
assert.match(panel, /disabledReason=\{actionDisabledReason\}/, "retention execution explains unavailable actions");
|
|
assert.match(panel, /<ConfirmDialog/, "destructive retention uses shared confirmation");
|
|
assert.match(panel, /<DataGrid/, "retention outcomes use the shared data-grid pattern");
|
|
assert.doesNotMatch(panel, /admin-json-preview/, "retention outcome is not presented as raw JSON");
|
|
assert.doesNotMatch(panel, /<pre/, "retention outcome is a typed projection");
|
|
|
|
assert.match(viewPanel, /policy\.impact-preview\.action\.preview/, "View policy exposes stable impact-preview help");
|
|
assert.match(viewPanel, /previewCurrent/, "View policy binds Save to the current dirty-draft preview");
|
|
assert.match(viewPanel, /updateViewPolicy\([\s\S]*impactPreview/, "View policy carries preview evidence into the commit request");
|
|
assert.match(viewPanel, /prepareResetPolicy/, "inherited-policy removal receives its own impact preview");
|
|
assert.match(viewPanel, /newly_allowed/, "View policy presents typed impact outcome counts");
|
|
assert.match(viewPanel, /populations\.map/, "View policy explains provider coverage state");
|
|
|
|
console.log("Policy interface-pattern contracts passed.");
|