22541 extract simple link-text breadcrumb route map and add structure tests
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
const assert = require("assert");
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
|
||||
const tests = [];
|
||||
const test = (name, fn) => tests.push({ name, fn });
|
||||
|
||||
const loadBreadcrumbSource = () => {
|
||||
const filePath = path.join(
|
||||
__dirname,
|
||||
"..",
|
||||
"..",
|
||||
"components",
|
||||
"breadcrumbs.js"
|
||||
);
|
||||
return fs.readFileSync(filePath, "utf8");
|
||||
};
|
||||
|
||||
test("breadcrumbs/simple-link-text map includes address and advanced search result routes", async () => {
|
||||
const source = loadBreadcrumbSource();
|
||||
|
||||
assert.strictEqual(
|
||||
source.includes('"/addresssearchresults": () => ('),
|
||||
true,
|
||||
"Expected /addresssearchresults to be mapped in getSimpleLinkTextPairRenderer"
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
source.includes('"/advancedsearchresults": () => ('),
|
||||
true,
|
||||
"Expected /advancedsearchresults to be mapped in getSimpleLinkTextPairRenderer"
|
||||
);
|
||||
});
|
||||
|
||||
test("breadcrumbs/dynamic callback branch remains explicit for myportal case incident route", async () => {
|
||||
const source = loadBreadcrumbSource();
|
||||
|
||||
assert.strictEqual(
|
||||
source.includes('isPath("/myportal/case/id/[incident]")'),
|
||||
true,
|
||||
"Expected dynamic /myportal/case/id/[incident] breadcrumb branch to remain explicit"
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
source.includes("router.back();"),
|
||||
true,
|
||||
"Expected callback-driven router.back() behavior to remain explicit"
|
||||
);
|
||||
});
|
||||
|
||||
const run = async () => {
|
||||
let passed = 0;
|
||||
|
||||
for (const currentTest of tests) {
|
||||
await currentTest.fn();
|
||||
passed += 1;
|
||||
}
|
||||
|
||||
console.log(
|
||||
`Phase 22 breadcrumbs-route-map tests passed (${passed}/${tests.length}).`
|
||||
);
|
||||
};
|
||||
|
||||
module.exports = run;
|
||||
|
||||
if (require.main === module) {
|
||||
run().catch((error) => {
|
||||
console.error(error);
|
||||
process.exit(1);
|
||||
});
|
||||
}
|
||||
@@ -7,6 +7,7 @@ const runAuthRedirectSafetyTests = require("./auth-redirect-safety.test.cjs");
|
||||
const runI18nRouteParityTests = require("./i18n-route-parity.test.cjs");
|
||||
const runAzurestorageHelperTests = require("./azurestorage-helper-behaviour.test.cjs");
|
||||
const runRouteStateHelperTests = require("./route-state-helper.test.cjs");
|
||||
const runBreadcrumbsRouteMapStructureTests = require("./breadcrumbs-route-map-structure.test.cjs");
|
||||
|
||||
const run = async () => {
|
||||
await runCoreTokenTests();
|
||||
@@ -18,6 +19,7 @@ const run = async () => {
|
||||
await runI18nRouteParityTests();
|
||||
await runAzurestorageHelperTests();
|
||||
await runRouteStateHelperTests();
|
||||
await runBreadcrumbsRouteMapStructureTests();
|
||||
console.log("Phase 22 combined suite passed.");
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user