test(breadcrumbs): cover missing representation route map fallback

This commit is contained in:
2026-04-09 15:19:40 +01:00
parent 97cde880c0
commit 61254e3942
2 changed files with 60 additions and 0 deletions
+27
View File
@@ -860,6 +860,33 @@ Follow-ups:
- Closure slice 2: add focused negative-path representation map/dependency tolerance test coverage.
- Closure slice 3: resolve and guard remaining `/newappeal` inline edge branch treatment.
### CL-22541-Z2: breadcrumbs closure slice 2 — missing representation map negative-path guard
date: 2026-04-09
author: Cline
scope: `tests/phase22/breadcrumb-route-maps-helper.test.cjs`
type: change
rationale: Execute closure slice 2 by adding focused negative-path coverage ensuring resolver behavior remains stable when representation route-map dependency is missing from grouped map input.
impact: Test hardening only; no runtime route/auth/session/API/EN-CY/a11y behavior change.
status: completed
Summary:
- Added focused helper-level test:
- `resolveMappedRouteRenderer tolerates missing representation map entry in grouped map input`
- New assertions verify:
- missing `representationRouteRenderersByPath` resolves `/myportal/representation` to `null`
- later maps still resolve correctly (case detail fallback remains intact).
Validation:
- `node tests/phase22/breadcrumb-route-maps-helper.test.cjs` -> pass (7/7).
- `node tests/phase22/index.test.cjs` -> pass (combined suite).
Follow-ups:
- Closure slice 3: resolve and guard remaining `/newappeal` inline edge branch treatment.
### CL-00X: 22500 `components/elements/index.js` Phase 1 helper extraction
date: 2026-04-07
@@ -309,6 +309,39 @@ test("resolveMappedRouteRenderer skips invalid map entries and non-function rend
);
});
test("resolveMappedRouteRenderer tolerates missing representation map entry in grouped map input", () => {
const { buildBreadcrumbRendererMaps, resolveMappedRouteRenderer } =
loadHelpers();
const caseDetailRenderer = () => "case-detail";
const maps = buildBreadcrumbRendererMaps({
simpleRouteRenderersByPath: {},
simpleLinkTextPairRenderersByPath: {},
simpleMyPortalRouteRenderersByPath: {},
newAppealRouteRenderersByPath: {},
callbackRouteRenderersByPath: {},
stepBackRouteRenderersByPath: {},
representationRouteRenderersByPath: undefined,
caseDetailRouteRenderersByPath: {
"/case/[ticketnumber]": caseDetailRenderer
},
detailAndAccountRouteRenderersByPath: {}
});
assert.strictEqual(
resolveMappedRouteRenderer("/myportal/representation", maps),
null,
"Expected null when representation renderer map is missing"
);
assert.strictEqual(
resolveMappedRouteRenderer("/case/[ticketnumber]", maps),
caseDetailRenderer,
"Expected later grouped map resolution to remain intact when representation map is missing"
);
});
const run = async () => {
let passed = 0;