fix(housekeeping): satisfy ase route types

This commit is contained in:
Simo committed 2026-08-26 20:52:13 +02:00
1 parent a9bdd6bd5d
commit 67cb4b488d
2 files changed
+20 -10

No files matched your search

@@ -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<string, unknown>;
const canonicalOperations = manifest("operations") as unknown as Record<
string,
unknown
>;
delete canonicalOperations.canonicalHref;
canonicalOperations.canonicalHref = "/ase";
@@ -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}`);
}