Update hivegrid-cloud reference to latest main
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e98d38e716
commit
7b21524c86
3781 files changed
+373484
-225607
No files matched your search
+62
@@ -0,0 +1,62 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
DASHBOARD_CUSTOMIZE_PERMISSION,
|
||||
DASHBOARD_MODULE_KEY,
|
||||
DASHBOARD_READ_PERMISSION,
|
||||
getDashboardWidgetCatalog,
|
||||
getDefaultDashboardRoleLayouts,
|
||||
LEGACY_DASHBOARD_PERMISSION,
|
||||
} from "./dashboard.server";
|
||||
|
||||
describe("dashboard role layout contract", () => {
|
||||
it("defines the R-P11b dashboard module and permissions", () => {
|
||||
expect(DASHBOARD_MODULE_KEY).toBe("dashboard");
|
||||
expect(DASHBOARD_READ_PERMISSION).toBe("dashboard.read");
|
||||
expect(DASHBOARD_CUSTOMIZE_PERMISSION).toBe("dashboard.customize");
|
||||
expect(LEGACY_DASHBOARD_PERMISSION).toBe("app.dashboard.view");
|
||||
});
|
||||
|
||||
it("ships exactly the fixed v1 GF, office, and Monteur layouts", () => {
|
||||
const layouts = getDefaultDashboardRoleLayouts();
|
||||
|
||||
expect(layouts.map((layout) => layout.role)).toEqual(["gf", "office", "monteur"]);
|
||||
expect(layouts.find((layout) => layout.role === "monteur")?.mobileFirst).toBe(true);
|
||||
expect(layouts.find((layout) => layout.role === "gf")?.widgets.map((widget) => widget.key)).toEqual([
|
||||
"general.welcome",
|
||||
"sales.kpis",
|
||||
"sales.forecast",
|
||||
"projects.kpis",
|
||||
"hr.requests_pending",
|
||||
"projects.open_defects",
|
||||
"activity.recent",
|
||||
]);
|
||||
expect(layouts.find((layout) => layout.role === "office")?.widgets.map((widget) => widget.key)).toEqual([
|
||||
"general.welcome",
|
||||
"projects.kpis",
|
||||
"tasks.my_open",
|
||||
"comms.calls_today",
|
||||
"hr.requests_pending",
|
||||
"activity.recent",
|
||||
]);
|
||||
expect(layouts.find((layout) => layout.role === "monteur")?.widgets.map((widget) => widget.key)).toEqual([
|
||||
"schedule.my_today",
|
||||
"projects.my_active",
|
||||
"tasks.my_open",
|
||||
]);
|
||||
});
|
||||
|
||||
it("covers Sales, Projekte, Tasks, HR, Activity, and Comms in the widget catalog", () => {
|
||||
const catalog = getDashboardWidgetCatalog();
|
||||
const domains = new Set(catalog.map((widget) => widget.domain));
|
||||
const catalogKeys = new Set(catalog.map((widget) => widget.key));
|
||||
|
||||
expect(domains).toEqual(new Set(["general", "sales", "projects", "tasks", "hr", "activity", "comms", "schedule"]));
|
||||
for (const layout of getDefaultDashboardRoleLayouts()) {
|
||||
for (const widget of layout.widgets) {
|
||||
expect(catalogKeys.has(widget.key), `${layout.role}.${widget.key}`).toBe(true);
|
||||
}
|
||||
}
|
||||
expect(catalog.find((widget) => widget.key === "sales.kpis")?.requiredAnyPermission).toContain("projects.read_all");
|
||||
expect(catalog.find((widget) => widget.key === "tasks.my_open")?.requiredAnyPermission).toContain("tasks.read_own");
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user