From 67cb4b488d1698de81b06f547b56147a71d717a9 Mon Sep 17 00:00:00 2001 From: simoleo89 Date: Wed, 26 Aug 2026 20:52:13 +0200 Subject: [PATCH] fix(housekeeping): satisfy ase route types --- .../housekeeping/foundation/registry.test.ts | 26 ++++++++++++------- .../housekeeping/foundation/routing/href.ts | 4 ++- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/src/features/housekeeping/foundation/registry.test.ts b/src/features/housekeeping/foundation/registry.test.ts index 5dd58fb1d9..50c9147f3e 100644 --- a/src/features/housekeeping/foundation/registry.test.ts +++ b/src/features/housekeeping/foundation/registry.test.ts @@ -232,7 +232,7 @@ describe("housekeeping registry", () => { { id: "users", labelKey: "pages.housekeeping.domains.people.title", - href: "/ase/people/users", + href: "/ase/people/users" as `/ase${string}`, capability: anyCapability(PERMS.USERS_VIEW), }, { @@ -253,13 +253,13 @@ describe("housekeeping registry", () => { { id: "users", labelKey: "pages.housekeeping.domains.people.title", - href: "/ase/people/users", + href: "/ase/people/users" as `/ase${string}`, capability: anyCapability(PERMS.USERS_VIEW), }, { id: "staff", labelKey: "pages.housekeeping.domains.people.title", - href: "/ase/people/users", + href: "/ase/people/users" as `/ase${string}`, capability: anyCapability(PERMS.USERS_VIEW), }, ], @@ -272,7 +272,7 @@ describe("housekeeping registry", () => { const route = { id: "users", labelKey: "pages.housekeeping.domains.people.title", - href: "/ase/people/users", + href: "/ase/people/users" as `/ase${string}`, capability: anyCapability(PERMS.USERS_VIEW), }; @@ -283,7 +283,10 @@ describe("housekeeping registry", () => { ).toThrow("empty route id"); expect(() => createHousekeepingRegistry([ - { ...manifest("people"), routes: [{ ...route, href: " " }] }, + { + ...manifest("people"), + routes: [{ ...route, href: " " as `/ase${string}` }], + }, ]), ).toThrow("empty route href"); expect(() => @@ -481,7 +484,7 @@ describe("housekeeping registry", () => { { id: "users", labelKey: "pages.housekeeping.domains.people.title", - href: "/ase/people/users", + href: "/ase/people/users" as `/ase${string}`, capability: { mode: "any", slugs: [] }, }, ], @@ -494,7 +497,7 @@ describe("housekeeping registry", () => { const route = { id: "shared", labelKey: "pages.housekeeping.domains.people.title", - href: "/ase/shared", + href: "/ase/shared" as `/ase${string}`, capability: anyCapability(PERMS.USERS_VIEW), }; @@ -503,7 +506,9 @@ describe("housekeeping registry", () => { { ...manifest("people"), routes: [route] }, { ...manifest("content"), - routes: [{ ...route, href: "/ase/content/shared" }], + routes: [ + { ...route, href: "/ase/content/shared" as `/ase${string}` }, + ], }, ]), ).toThrow("duplicate route id"); @@ -520,7 +525,10 @@ describe("housekeeping registry", () => { }); it("accepts the canonical operations root and rejects legacy admin hrefs", () => { - const canonicalOperations = manifest("operations") as Record; + const canonicalOperations = manifest("operations") as unknown as Record< + string, + unknown + >; delete canonicalOperations.canonicalHref; canonicalOperations.canonicalHref = "/ase"; diff --git a/src/features/housekeeping/foundation/routing/href.ts b/src/features/housekeeping/foundation/routing/href.ts index dfc9218a99..d80b682cda 100644 --- a/src/features/housekeeping/foundation/routing/href.ts +++ b/src/features/housekeeping/foundation/routing/href.ts @@ -11,5 +11,7 @@ export function toHousekeepingHref( throw new Error(`invalid canonical housekeeping href: ${href}`); } - return surface === "canonical" ? href : href.replace(/^\/ase/, "/ase-next"); + return surface === "canonical" + ? href + : (`/ase-next${href.slice(4)}` as `/ase-next${string}`); }