Files
govoplan-campaign/webui/tests/campaign-collaboration-ui-structure.test.mjs
zemion c2f083e5f6
Module Package Release / publish-packages (push) Successful in 13s
feat(campaigns): add governed collaboration thread
2026-08-22 00:09:34 +02:00

45 lines
1.6 KiB
JavaScript

import assert from "node:assert/strict";
import fs from "node:fs";
import path from "node:path";
import { fileURLToPath } from "node:url";
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
const page = fs.readFileSync(
path.join(root, "src/features/campaigns/CampaignCollaborationPage.tsx"),
"utf8"
);
const workspace = fs.readFileSync(
path.join(root, "src/features/campaigns/CampaignWorkspace.tsx"),
"utf8"
);
const sidebar = fs.readFileSync(
path.join(root, "src/layout/SectionSidebar.tsx"),
"utf8"
);
const api = fs.readFileSync(path.join(root, "src/api/campaigns.ts"), "utf8");
assert.match(page, /archetype="collection"/);
assert.match(page, /variant="collection"/);
assert.match(page, /refreshable/);
assert.match(page, /ReferenceMultiSelect/);
assert.match(page, /ConfirmDialog/);
assert.match(page, /campaigns:discussion:post/);
assert.match(page, /campaigns:discussion:moderate/);
assert.match(page, /maxLength=\{8000\}/);
assert.match(page, /<ol[^>]+aria-label="Campaign collaboration thread"/);
assert.match(page, /entry\.tombstone/);
assert.match(page, /collaboration_audit_boundary/);
assert.doesNotMatch(page, /updateCampaignVersion|saveCampaignVersion/);
assert.match(workspace, /path="activity"/);
assert.match(workspace, /CampaignCollaborationPage/);
assert.match(sidebar, /canReadActivity/);
assert.match(sidebar, /id: "activity"/);
assert.match(api, /\/collaboration\?/);
assert.match(api, /\/withdraw/);
assert.match(api, /\/redact/);
assert.match(api, /\/collaboration\/mention-options/);
console.log("Campaign collaboration UI structure checks passed.");