import assert from "node:assert/strict"; import { readFileSync } from "node:fs"; const page = readFileSync(new URL("../src/features/campaigns/CampaignWorkPage.tsx", import.meta.url), "utf8"); const api = readFileSync(new URL("../src/api/campaigns.ts", import.meta.url), "utf8"); const workspace = readFileSync(new URL("../src/features/campaigns/CampaignWorkspace.tsx", import.meta.url), "utf8"); const sidebar = readFileSync(new URL("../src/layout/SectionSidebar.tsx", import.meta.url), "utf8"); for (const primitive of [ "PageLayout", "PageActionBar", "Card", "FormField", "ReferenceSelect", "DateTimeField", "Dialog", "ConfirmDialog", "StatusBadge", "DismissibleAlert" ]) { assert.match(page, new RegExp(`\\b${primitive}\\b`), `Campaign work should use centralized ${primitive}`); } assert.match(page, /archetype="collection"/); assert.match(page, /refreshable/); assert.match(page, /createAction=/); assert.match(page, /campaign-work-destructive-action/); assert.match(page, /tone="danger"/); assert.match(page, /assignment records responsibility only/i); assert.match(page, /Campaign sharing, ownership transfer, approval and Audit remain separate/i); assert.match(page, /Reconcile assignees/); assert.match(page, /History/); for (const contract of [ "/assignments?", "/assignments/${encodeURIComponent(assignment.id)}/transition", "/assignments/${encodeURIComponent(assignmentId)}/reassign", "/assignments/${encodeURIComponent(assignmentId)}/history", "/assignments/reconcile", "/assignments/options" ]) { assert.ok(api.includes(contract), `Campaign API should expose ${contract}`); } assert.match(workspace, /path="work"/); assert.match(workspace, /campaigns:assignment:read/); assert.match(sidebar, /id: "work"/); assert.match(sidebar, /canReadWork/); console.log("campaign work UI structure tests passed");