Track HiveGrid Cloud planning reference
This commit is contained in:
1 parent
b3d5ea6764
commit
e341c5938a
5784 files changed
+1104929
-3
No files matched your search
@@ -0,0 +1,45 @@
|
||||
import { readFileSync } from "node:fs";
|
||||
import { join } from "node:path";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { flattenNavigationItems } from "./navigation";
|
||||
|
||||
describe("admin navigation sidebar preview boundary", () => {
|
||||
it("does not build app sidebar links with an empty tenant slug", () => {
|
||||
const source = readFileSync(join(process.cwd(), "apps/web/app/routes/admin/navigation.tsx"), "utf8");
|
||||
|
||||
expect(source).toContain("if (params.tenant)");
|
||||
expect(source).not.toContain('tenantId: params.tenant || ""');
|
||||
});
|
||||
|
||||
it("flattens sidebar children while keeping collapsible parents toggle-only", () => {
|
||||
const items = flattenNavigationItems(
|
||||
[
|
||||
{
|
||||
title: "Settings",
|
||||
path: "/settings",
|
||||
isCollapsible: true,
|
||||
items: [
|
||||
{ title: "Profile", path: "/settings/profile" },
|
||||
{ title: "Hidden", path: "/settings/hidden", hidden: true },
|
||||
],
|
||||
},
|
||||
{
|
||||
title: "Accounts",
|
||||
path: "/accounts",
|
||||
items: [{ title: "Users", path: "/accounts/users" }],
|
||||
},
|
||||
],
|
||||
true
|
||||
);
|
||||
|
||||
expect(items.map((item) => item.path)).toEqual(["/settings/profile", "/accounts", "/accounts/users"]);
|
||||
expect(items.every((item) => item.adminOnly)).toBe(true);
|
||||
});
|
||||
|
||||
it("uses resolved sidebar labels directly instead of translating them again", () => {
|
||||
const source = readFileSync(join(process.cwd(), "apps/web/app/routes/admin/navigation.tsx"), "utf8");
|
||||
|
||||
expect(source).toContain("{item.title}");
|
||||
expect(source).not.toContain("{t(item.title)}");
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user