fix(housekeeping): make route matching deterministic
This commit is contained in:
1 parent
e5c230ba35
commit
0117b45d74
4 files changed
+256
-45
No files matched your search
@@ -102,6 +102,35 @@ describe("matchHousekeepingRoute", () => {
|
||||
).toBeNull();
|
||||
});
|
||||
|
||||
it.each([
|
||||
{
|
||||
routes: [
|
||||
route("people.kind-settings", "/ase/people/:kind/settings"),
|
||||
route("people.user-detail", "/ase/people/users/:id"),
|
||||
],
|
||||
},
|
||||
{
|
||||
routes: [
|
||||
route("people.user-detail", "/ase/people/users/:id"),
|
||||
route("people.kind-settings", "/ase/people/:kind/settings"),
|
||||
],
|
||||
},
|
||||
])(
|
||||
"prefers the earliest static segment regardless of registration order",
|
||||
({ routes }) => {
|
||||
const orderedRegistry = createHousekeepingRegistry([
|
||||
peopleManifest(routes),
|
||||
]);
|
||||
|
||||
expect(
|
||||
matchHousekeepingRoute(orderedRegistry, "/ase/people/users/settings"),
|
||||
)?.toMatchObject({
|
||||
routeId: "people.user-detail",
|
||||
params: { id: "settings" },
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
it.each([
|
||||
"/ase/people/unknown",
|
||||
"/ase/economy/users",
|
||||
|
||||
Reference in new issue
Block a user