test(javascript): bound route scan work independently of timing (#7016)

This commit is contained in:
gensokyo-dev authored and GitHub committed 2026-10-24 15:37:10 +00:00
1 parent 8c6cddcffb
commit cc7cc8155a
2 files changed
+76 -9

No files matched your search

@@ -70,14 +70,16 @@ it("reports path properties outside router records only as candidates", () => {
]);
});
it("scans an object's route fields once for repeated path keys", () => {
const start = performance.now();
it("preserves every repeated path property's candidate and source order", () => {
const count = 256;
const endpoints = routeEndpoints(
`const record = { ${Array.from({ length: 20_000 }, (_, i) => `path: "p${String(i)}"`).join(", ")} };`,
`const record = { ${Array.from({ length: count }, (_, i) => `path: "p${String(i)}"`).join(", ")} };`,
);
expect(endpoints).toHaveLength(20_000);
expect(
endpoints.every(({ interpretation }) => interpretation === "candidate"),
).toBe(true);
expect(performance.now() - start).toBeLessThan(2000);
}, 30000);
expect(endpoints).toEqual(
Array.from({ length: count }, (_, i) => ({
value: `p${String(i)}`,
mechanism: "property:path",
interpretation: "candidate",
})),
);
});