refactor(housekeeping): adopt ase route namespace
This commit is contained in:
@@ -23,7 +23,7 @@ describe("housekeeping navigation", () => {
|
||||
labelKey: "pages.housekeeping.domains.people.title",
|
||||
descriptionKey: "pages.housekeeping.domains.people.description",
|
||||
iconId: "users",
|
||||
previewHref: "/admin-next/people",
|
||||
canonicalHref: "/ase/people",
|
||||
capability: anyCapability(PERMS.MOD_CFH_VIEW),
|
||||
routes: [],
|
||||
searchProviders: [],
|
||||
@@ -35,7 +35,7 @@ describe("housekeeping navigation", () => {
|
||||
labelKey: "pages.housekeeping.domains.economy.title",
|
||||
descriptionKey: "pages.housekeeping.domains.economy.description",
|
||||
iconId: "gem",
|
||||
previewHref: "/admin-next/economy",
|
||||
canonicalHref: "/ase/economy",
|
||||
capability: anyCapability(PERMS.CATALOG_VIEW),
|
||||
routes: [],
|
||||
searchProviders: [],
|
||||
@@ -47,13 +47,14 @@ describe("housekeeping navigation", () => {
|
||||
const navigation = buildHousekeepingNavigation(
|
||||
registry,
|
||||
context([PERMS.MOD_CFH_VIEW]),
|
||||
"canonical",
|
||||
(key) => key,
|
||||
);
|
||||
|
||||
expect(navigation).toEqual([
|
||||
{
|
||||
id: "people",
|
||||
href: "/admin-next/people",
|
||||
href: "/ase/people",
|
||||
iconId: "users",
|
||||
label: "pages.housekeeping.domains.people.title",
|
||||
description: "pages.housekeeping.domains.people.description",
|
||||
@@ -69,19 +70,19 @@ describe("housekeeping navigation", () => {
|
||||
labelKey: "people.title",
|
||||
descriptionKey: "people.description",
|
||||
iconId: "users",
|
||||
previewHref: "/admin-next/people",
|
||||
canonicalHref: "/ase/people",
|
||||
capability: anyCapability(PERMS.USERS_VIEW),
|
||||
routes: [
|
||||
{
|
||||
id: "users",
|
||||
labelKey: "people.users",
|
||||
href: "/admin-next/people/users",
|
||||
href: "/ase/people/users",
|
||||
capability: anyCapability(PERMS.USERS_VIEW),
|
||||
},
|
||||
{
|
||||
id: "bans",
|
||||
labelKey: "people.bans",
|
||||
href: "/admin-next/people/bans",
|
||||
href: "/ase/people/bans",
|
||||
capability: anyCapability(PERMS.BANS_VIEW),
|
||||
},
|
||||
],
|
||||
@@ -94,7 +95,7 @@ describe("housekeeping navigation", () => {
|
||||
labelKey: "system.title",
|
||||
descriptionKey: "system.description",
|
||||
iconId: "settings",
|
||||
previewHref: "/admin-next/system",
|
||||
canonicalHref: "/ase/system",
|
||||
capability: anyCapability(PERMS.SETTINGS_VIEW),
|
||||
routes: [],
|
||||
searchProviders: [],
|
||||
@@ -107,20 +108,21 @@ describe("housekeeping navigation", () => {
|
||||
const navigation = buildHousekeepingNavigation(
|
||||
registry,
|
||||
context([PERMS.USERS_VIEW]),
|
||||
"canonical",
|
||||
translate,
|
||||
);
|
||||
|
||||
expect(navigation).toEqual([
|
||||
{
|
||||
id: "people",
|
||||
href: "/admin-next/people",
|
||||
href: "/ase/people",
|
||||
iconId: "users",
|
||||
label: "translated:people.title",
|
||||
description: "translated:people.description",
|
||||
items: [
|
||||
{
|
||||
id: "users",
|
||||
href: "/admin-next/people/users",
|
||||
href: "/ase/people/users",
|
||||
label: "translated:people.users",
|
||||
},
|
||||
],
|
||||
@@ -138,6 +140,7 @@ describe("housekeeping navigation", () => {
|
||||
buildHousekeepingNavigation(
|
||||
registry,
|
||||
context([PERMS.MOD_CFH_VIEW]),
|
||||
"preview",
|
||||
translate,
|
||||
).map((domain) => domain.id),
|
||||
).toContain("people");
|
||||
@@ -145,6 +148,7 @@ describe("housekeeping navigation", () => {
|
||||
buildHousekeepingNavigation(
|
||||
registry,
|
||||
context([PERMS.MOD_CFH_VIEW]),
|
||||
"preview",
|
||||
translate,
|
||||
).map((domain) => domain.id),
|
||||
).not.toContain("economy");
|
||||
@@ -160,6 +164,7 @@ describe("housekeeping navigation", () => {
|
||||
const visibleDomainIds = buildHousekeepingNavigation(
|
||||
registry,
|
||||
context([slug]),
|
||||
"preview",
|
||||
translate,
|
||||
).map((domain) => domain.id);
|
||||
|
||||
@@ -167,3 +172,38 @@ describe("housekeeping navigation", () => {
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it("maps canonical navigation hrefs onto the requested surface", () => {
|
||||
const registry = createHousekeepingRegistry([
|
||||
{
|
||||
id: "people",
|
||||
labelKey: "people.title",
|
||||
descriptionKey: "people.description",
|
||||
iconId: "users",
|
||||
canonicalHref: "/ase/people",
|
||||
capability: anyCapability(PERMS.USERS_VIEW),
|
||||
routes: [
|
||||
{
|
||||
id: "users",
|
||||
labelKey: "people.users",
|
||||
href: "/ase/people/users",
|
||||
capability: anyCapability(PERMS.USERS_VIEW),
|
||||
},
|
||||
],
|
||||
searchProviders: [],
|
||||
inboxSources: [],
|
||||
widgets: [],
|
||||
},
|
||||
]);
|
||||
const navigation = buildHousekeepingNavigation(
|
||||
registry,
|
||||
context([PERMS.USERS_VIEW]),
|
||||
"preview",
|
||||
(key) => key,
|
||||
);
|
||||
|
||||
expect(navigation[0]).toMatchObject({
|
||||
href: "/ase-next/people",
|
||||
items: [{ href: "/ase-next/people/users" }],
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user