feat: integrate reports into Campaign navigation

This commit is contained in:
2026-07-29 22:19:24 +02:00
parent 101f3ccd7d
commit cc93945f79
7 changed files with 123 additions and 28 deletions

View File

@@ -67,11 +67,19 @@ assert.doesNotMatch(source, /humanize\(/);
assert.match(campaignModulePage, /<ModuleSubnav/);
assert.match(campaignModulePage, /id: "campaigns"/);
assert.match(campaignModulePage, /id: "queue"/);
assert.match(campaignModulePage, /navigate\(section === "queue" \? "\/campaigns\/queue" : "\/campaigns"\)/);
assert.match(campaignModulePage, /id: "reports"/);
assert.match(campaignModulePage, /campaigns: "\/campaigns"/);
assert.match(campaignModulePage, /queue: "\/campaigns\/queue"/);
assert.match(campaignModulePage, /reports: "\/campaigns\/reports"/);
assert.match(campaignModulePage, /navigate\(routes\[section\]\)/);
assert.match(campaignModulePage, /active === "queue"[\s\S]*<OperatorQueuePage/);
assert.match(campaignModulePage, /active === "reports"[\s\S]*<AggregateReportsPage/);
assert.match(moduleSource, /path: "\/campaigns\/queue"/);
assert.match(moduleSource, /path: "\/operator"[\s\S]*createElement\(Navigate, \{ to: "\/campaigns\/queue", replace: true \}\)/);
assert.match(moduleSource, /path: "\/campaigns\/reports"/);
assert.match(moduleSource, /path: "\/reports"[\s\S]*createElement\(Navigate, \{ to: "\/campaigns\/reports", replace: true \}\)/);
assert.doesNotMatch(moduleSource, /to: "\/operator"/);
assert.doesNotMatch(moduleSource, /to: "\/reports"/);
assert.ok(
moduleSource.indexOf('{ path: "/operator"') < moduleSource.indexOf('{ path: "/campaigns/queue"'),
"the canonical Campaign route must replace the legacy alias in the shared view-surface catalogue"
@@ -81,6 +89,24 @@ assert.equal(
2,
"the legacy redirect and canonical queue route share one configurable view surface"
);
assert.ok(
moduleSource.indexOf('{ path: "/reports"') < moduleSource.indexOf('{ path: "/campaigns/reports"'),
"the canonical Campaign reports route must replace the legacy alias in the shared view-surface catalogue"
);
assert.equal(
moduleSource.split("surfaceId: reportsSurface").length - 1,
2,
"the legacy redirect and canonical reports route share one configurable view surface"
);
assert.equal(
moduleSource.split("anyOf: campaignModuleRead").length - 1,
2,
"the Campaign navigation and landing route remain available to report-only readers"
);
assert.match(
moduleSource,
/function CampaignModuleLandingRoute[\s\S]*!hasAnyScope\(auth, campaignRead\)[\s\S]*to: "\/campaigns\/reports"/
);
const localized = new Map([
["i18n:govoplan-campaign.claimed.83c87884", ["Claimed", "Beansprucht"]],