refactor(breadcrumbs): extract representation route-state renderer group

This commit is contained in:
2026-04-09 15:16:01 +01:00
parent 7a60e64a84
commit d3f4dda8af
6 changed files with 160 additions and 38 deletions
@@ -54,6 +54,12 @@ test("breadcrumbs/factory module includes expected mapped route definitions", as
"Expected step-back route renderer factory export"
);
assert.strictEqual(
source.includes("export const createRepresentationRouteRenderers ="),
true,
"Expected representation route renderer factory export"
);
assert.strictEqual(
source.includes("export const createCaseDetailRouteRenderers ="),
true,
@@ -132,6 +138,12 @@ test("breadcrumbs/factory module includes expected mapped route definitions", as
"Expected /myportal/[appealtypes] to be mapped in createStepBackRouteRenderers"
);
assert.strictEqual(
source.includes('"/myportal/representation": () => ('),
true,
"Expected /myportal/representation to be mapped in createRepresentationRouteRenderers"
);
assert.strictEqual(
source.includes('"/case/[ticketnumber]": () =>'),
true,
@@ -221,7 +233,7 @@ test("breadcrumbs/component composes mapped routes via imported factories and sh
);
assert.strictEqual(
/const\s+\{[\s\S]*simpleRouteRenderersByPath[\s\S]*newAppealRouteRenderersByPath[\s\S]*callbackRouteRenderersByPath[\s\S]*stepBackRouteRenderersByPath[\s\S]*detailAndAccountRouteRenderersByPath[\s\S]*\}\s*=\s*createMappedRouteRendererGroups\s*\(/.test(
/const\s+\{[\s\S]*simpleRouteRenderersByPath[\s\S]*newAppealRouteRenderersByPath[\s\S]*callbackRouteRenderersByPath[\s\S]*stepBackRouteRenderersByPath[\s\S]*representationRouteRenderersByPath[\s\S]*detailAndAccountRouteRenderersByPath[\s\S]*\}\s*=\s*createMappedRouteRendererGroups\s*\(/.test(
source
),
true,
@@ -320,6 +332,12 @@ test("breadcrumbs/component composes mapped routes via imported factories and sh
"Expected /myportal/[appealtypes] explicit branch to be removed after step-back mapping"
);
assert.strictEqual(
source.includes('isPath("/myportal/representation")'),
false,
"Expected /myportal/representation explicit branch to be removed after representation mapping"
);
assert.strictEqual(
source.includes('isPath("/myportal/case/[ticketnumber]")'),
false,
@@ -405,6 +423,9 @@ test("breadcrumbs/map builder preserves route map ordering", async () => {
const stepBackOrderIndex = mapBuilderSlice.indexOf(
"stepBackRouteRenderersByPath"
);
const representationOrderIndex = mapBuilderSlice.indexOf(
"representationRouteRenderersByPath"
);
const caseDetailOrderIndex = mapBuilderSlice.indexOf(
"caseDetailRouteRenderersByPath"
);
@@ -419,10 +440,11 @@ test("breadcrumbs/map builder preserves route map ordering", async () => {
newAppealOrderIndex > simpleMyPortalOrderIndex &&
callbackOrderIndex > newAppealOrderIndex &&
stepBackOrderIndex > callbackOrderIndex &&
caseDetailOrderIndex > stepBackOrderIndex &&
representationOrderIndex > stepBackOrderIndex &&
caseDetailOrderIndex > representationOrderIndex &&
detailAndAccountOrderIndex > caseDetailOrderIndex,
true,
"Expected map builder call to preserve explicit route-map ordering (simple -> link-text -> myportal -> new-appeal -> callback -> step-back -> case detail -> detail/account)"
"Expected map builder call to preserve explicit route-map ordering (simple -> link-text -> myportal -> new-appeal -> callback -> step-back -> representation -> case detail -> detail/account)"
);
});