Refresh HiveGrid Cloud reference snapshot
This commit is contained in:
1 parent
5e99e14772
commit
7f88026f79
5955 files changed
+1177325
-188362
No files matched your search
@@ -1,9 +1,44 @@
|
||||
import { describe, expect, test } from "vitest";
|
||||
import {
|
||||
buildBillingPaymentVM,
|
||||
buildBillingUsageVM,
|
||||
buildSeatUsageVM,
|
||||
buildSubscriptionOverviewVM,
|
||||
toDemoDataSettingsVM,
|
||||
toFirstStepsChecklistVM,
|
||||
} from "@hivegrid/view-models";
|
||||
|
||||
import {
|
||||
createAutomationEditorFixturePage,
|
||||
createChatDetailInterimFixturePage,
|
||||
createChatIndexInterimFixturePage,
|
||||
createCrmInterimFixturePage,
|
||||
createCrmInterimFixtureViewModel,
|
||||
createDashboardInterimFixturePage,
|
||||
createEmailComposeInterimFixturePage,
|
||||
createEmailDetailInterimFixturePage,
|
||||
createEmailInboxInterimFixturePage,
|
||||
createHotSwapDrillPage,
|
||||
createHrCoreInterimFixturePage,
|
||||
createHrWorkflowsInterimFixturePage,
|
||||
createLeadInterimFixturePage,
|
||||
createLeadInterimFixtureViewModel,
|
||||
createProjektBoardInterimFixturePage,
|
||||
createProjektBoardInterimFixtureViewModel,
|
||||
createProjektOperationsInterimFixturePage,
|
||||
createProjektOperationsInterimFixtureViewModels,
|
||||
createMockPage,
|
||||
createMockRegistry,
|
||||
createP20InterimFixturePage,
|
||||
createPluginCatalogInterimFixturePage,
|
||||
createSpotlightInterimFixturePage,
|
||||
createTelephonyInterimFixturePage,
|
||||
createVaP24aInterimFixturePage,
|
||||
createVaP24aInterimFixtureViewModel,
|
||||
createVaP26aInterimFixturePage,
|
||||
createVaP26aInterimFixtureViewModel,
|
||||
createVaP26bInterimFixturePages,
|
||||
createVaP26cInterimFixturePage,
|
||||
createVisualSnapshot,
|
||||
generateHotSwapMock,
|
||||
generateMockArtifacts,
|
||||
@@ -15,7 +50,7 @@ describe("@hivegrid/ui-mock", () => {
|
||||
const page = createMockPage({ id: "empty", route: "/empty", state: { status: "empty" } });
|
||||
const registry = createMockRegistry([page]);
|
||||
expect(registry.get("/empty")).toBe(page);
|
||||
expect(generateHotSwapMock(page)).toContain("\"route\": \"/empty\"");
|
||||
expect(generateHotSwapMock(page)).toContain('"route": "/empty"');
|
||||
});
|
||||
|
||||
test("generates deterministic mock module and static page artifacts", () => {
|
||||
@@ -23,7 +58,7 @@ describe("@hivegrid/ui-mock", () => {
|
||||
const artifacts = generateMockArtifacts(page);
|
||||
|
||||
expect(artifacts.module).toContain("export const mockPage");
|
||||
expect(artifacts.module).toContain("\"id\": \"phase-c-hot-swap\"");
|
||||
expect(artifacts.module).toContain('"id": "phase-c-hot-swap"');
|
||||
expect(artifacts.html).toContain('data-ui-mock-route="/mock/phase-c/hot-swap"');
|
||||
expect(artifacts.html).toContain("Serialized state");
|
||||
expect(artifacts.html).toContain("Hot swap drill");
|
||||
@@ -31,6 +66,417 @@ describe("@hivegrid/ui-mock", () => {
|
||||
expect(artifacts.snapshot).toEqual(createVisualSnapshot(page, { html: artifacts.html, module: artifacts.module }));
|
||||
});
|
||||
|
||||
test("builds the R-P11b dashboard interim fixture page from the shared VM builder", () => {
|
||||
const page = createDashboardInterimFixturePage();
|
||||
|
||||
expect(page.id).toBe("r-p11b-dashboard-interim");
|
||||
expect(page.route).toBe("/mock/r-p11b/dashboard");
|
||||
expect(page.state.status).toBe("ready");
|
||||
if (page.state.status !== "ready") throw new Error("fixture not ready");
|
||||
expect(page.state.data.activeRole).toBe("gf");
|
||||
// Only the derived layout travels in the payload — no switcher, no other roles.
|
||||
expect(page.state.data.layout.role).toBe("gf");
|
||||
expect(page.state.data.layout.widgets.map((widget) => widget.key)).toContain("sales.order_intake");
|
||||
expect(page.state.data.layout.widgets.find((widget) => widget.key === "sales.order_intake")?.series?.points.length).toBeGreaterThan(0);
|
||||
|
||||
const artifacts = generateMockArtifacts(page);
|
||||
expect(artifacts.module).toContain('"id": "r-p11b-dashboard-interim"');
|
||||
expect(artifacts.html).toContain('data-ui-mock-route="/mock/r-p11b/dashboard"');
|
||||
expect(artifacts.html).toContain("Dashboard interim drill (R-P11b)");
|
||||
// Determinism: same fixture input -> identical artifacts.
|
||||
expect(generateMockArtifacts(createDashboardInterimFixturePage())).toEqual(artifacts);
|
||||
});
|
||||
|
||||
test("builds the R-P11a Spotlight fixture from the shared grouping VM", () => {
|
||||
const page = createSpotlightInterimFixturePage();
|
||||
|
||||
expect(page.id).toBe("r-p11a-spotlight-interim");
|
||||
expect(page.route).toBe("/mock/r-p11a/spotlight");
|
||||
expect(page.state.status).toBe("ready");
|
||||
if (page.state.status !== "ready") throw new Error("fixture not ready");
|
||||
expect(page.state.data.designStatus).toBe("interim");
|
||||
expect(page.state.data.surfaces).toEqual({ desktop: "modal", mobile: "viewport" });
|
||||
expect(page.state.data.groups.map((group) => group.entityType)).toEqual(["contact", "project"]);
|
||||
expect(page.registries?.portals).toEqual([expect.objectContaining({ slot: "shell.commandPalette", permission: "search.use" })]);
|
||||
expect(page.registries?.sidebar).toBeUndefined();
|
||||
expect(page.registries?.mobile).toBeUndefined();
|
||||
|
||||
const artifacts = generateMockArtifacts(page);
|
||||
expect(artifacts.module).toContain('"id": "r-p11a-spotlight-interim"');
|
||||
expect(artifacts.html).toContain('data-ui-mock-route="/mock/r-p11a/spotlight"');
|
||||
expect(generateMockArtifacts(createSpotlightInterimFixturePage())).toEqual(artifacts);
|
||||
});
|
||||
|
||||
test("builds the R-P12b flow editor fixture with the reverse recipient contract", () => {
|
||||
const page = createAutomationEditorFixturePage();
|
||||
|
||||
expect(page.id).toBe("r-p12b-editor");
|
||||
expect(page.route).toBe("/mock/r-p12b/editor");
|
||||
expect(page.state.status).toBe("ready");
|
||||
if (page.state.status !== "ready") throw new Error("fixture not ready");
|
||||
expect(page.state.data.designStatus).toBe("subframe");
|
||||
expect(page.state.data.editor.steps.map((step) => step.nodeType)).toEqual(["forms.submitted", "task.create", "notification.send"]);
|
||||
expect(page.state.data.editor.pickerCategories).toEqual(["trigger", "action", "logic"]);
|
||||
expect(page.state.data.reverseExample.reversible).toBe(false);
|
||||
expect(page.state.data.reverseExample.recipients).toHaveLength(2);
|
||||
expect(page.registries?.breadcrumbs).toHaveLength(2);
|
||||
|
||||
const artifacts = generateMockArtifacts(page);
|
||||
expect(artifacts.module).toContain('"id": "r-p12b-editor"');
|
||||
expect(artifacts.html).toContain('data-ui-mock-route="/mock/r-p12b/editor"');
|
||||
expect(generateMockArtifacts(createAutomationEditorFixturePage())).toEqual(artifacts);
|
||||
});
|
||||
|
||||
test("builds the AK-UI-01 email inbox interim fixture from the shared VM builder", () => {
|
||||
const page = createEmailInboxInterimFixturePage();
|
||||
|
||||
expect(page.id).toBe("ak-ui-01-email-inbox-interim");
|
||||
expect(page.route).toBe("/mock/ak-ui-01/emails");
|
||||
expect(page.state.status).toBe("ready");
|
||||
if (page.state.status !== "ready") throw new Error("fixture not ready");
|
||||
expect(page.state.data.designStatus).toBe("interim");
|
||||
expect(page.state.data.screenRoute).toBe("/emails");
|
||||
expect(page.state.data.viewModel.status).toBe("ready");
|
||||
expect(page.state.data.viewModel.data?.rows.map((row) => row.id)).toEqual(["msg-1", "msg-2"]);
|
||||
expect(page.state.data.viewModel.data?.emptyHeadlineKey).toBe("emailInbox.list.empty.headline");
|
||||
expect(page.state.data.viewModel.data?.noMailboxHeadlineKey).toBe("emailInbox.list.noMailbox.headline");
|
||||
expect(page.state.data.viewModel.data?.nextCursor).toBe("2026-07-01T10:00:00.000Z~msg-2");
|
||||
expect(page.registries?.breadcrumbs).toHaveLength(2);
|
||||
|
||||
const artifacts = generateMockArtifacts(page);
|
||||
expect(artifacts.module).toContain('"id": "ak-ui-01-email-inbox-interim"');
|
||||
expect(artifacts.module).toContain('"designStatus": "interim"');
|
||||
expect(artifacts.html).toContain('data-ui-mock-route="/mock/ak-ui-01/emails"');
|
||||
expect(generateMockArtifacts(createEmailInboxInterimFixturePage())).toEqual(artifacts);
|
||||
});
|
||||
|
||||
test("builds the AK-UI-02 email detail interim fixture from the shared VM builder", () => {
|
||||
const page = createEmailDetailInterimFixturePage();
|
||||
|
||||
expect(page.id).toBe("ak-ui-02-email-detail-interim");
|
||||
expect(page.route).toBe("/mock/ak-ui-02/emails/msg-1");
|
||||
expect(page.state.status).toBe("ready");
|
||||
if (page.state.status !== "ready") throw new Error("fixture not ready");
|
||||
expect(page.state.data.designStatus).toBe("interim");
|
||||
expect(page.state.data.screenRoute).toBe("/emails/:id");
|
||||
expect(page.state.data.viewModel.status).toBe("ready");
|
||||
expect(page.state.data.viewModel.data?.thread.map((entry) => entry.id)).toEqual(["msg-0", "msg-1"]);
|
||||
expect(page.state.data.viewModel.data?.thread.filter((entry) => entry.isFocused)).toHaveLength(1);
|
||||
expect(page.state.data.viewModel.data?.match.sourceKey).toBe("emailInbox.detail.match.manual");
|
||||
// External images stay blocked until the explicit opt-in — the fixture pins that default.
|
||||
expect(page.state.data.viewModel.data?.allowExternalImages).toBe(false);
|
||||
expect(page.registries?.breadcrumbs).toHaveLength(2);
|
||||
|
||||
const artifacts = generateMockArtifacts(page);
|
||||
expect(artifacts.module).toContain('"id": "ak-ui-02-email-detail-interim"');
|
||||
expect(artifacts.module).toContain('"designStatus": "interim"');
|
||||
expect(artifacts.html).toContain('data-ui-mock-route="/mock/ak-ui-02/emails/msg-1"');
|
||||
expect(generateMockArtifacts(createEmailDetailInterimFixturePage())).toEqual(artifacts);
|
||||
});
|
||||
|
||||
test("builds the AK-UI-03 email compose interim fixture from the shared VM builder", () => {
|
||||
const page = createEmailComposeInterimFixturePage();
|
||||
|
||||
expect(page.id).toBe("ak-ui-03-email-compose-interim");
|
||||
expect(page.route).toBe("/mock/ak-ui-03/emails/new");
|
||||
expect(page.state.status).toBe("ready");
|
||||
if (page.state.status !== "ready") throw new Error("fixture not ready");
|
||||
expect(page.state.data.designStatus).toBe("interim");
|
||||
expect(page.state.data.screenRoute).toBe("/emails/new");
|
||||
expect(page.state.data.viewModel.status).toBe("ready");
|
||||
expect(page.state.data.viewModel.data?.mailboxes.map((mailbox) => mailbox.id)).toEqual(["mailbox-1", "mailbox-2"]);
|
||||
expect(page.state.data.viewModel.data?.noMailboxKey).toBe("emailInbox.compose.noMailbox");
|
||||
// The reply prefill runs through the real builder: sender + Re: + quoted original.
|
||||
expect(page.state.data.viewModel.data?.prefill.to).toBe("buero@demo-pro.example");
|
||||
expect(page.state.data.viewModel.data?.prefill.replyToMessageId).toBe("msg-1");
|
||||
expect(page.state.data.viewModel.data?.prefill.quotedHtml).toContain("<blockquote");
|
||||
expect(page.registries?.breadcrumbs).toHaveLength(2);
|
||||
|
||||
const artifacts = generateMockArtifacts(page);
|
||||
expect(artifacts.module).toContain('"id": "ak-ui-03-email-compose-interim"');
|
||||
expect(artifacts.module).toContain('"designStatus": "interim"');
|
||||
expect(artifacts.html).toContain('data-ui-mock-route="/mock/ak-ui-03/emails/new"');
|
||||
expect(generateMockArtifacts(createEmailComposeInterimFixturePage())).toEqual(artifacts);
|
||||
});
|
||||
|
||||
test("builds the AK-UI-05 plugin catalog interim fixture from the shared VM builder", () => {
|
||||
const page = createPluginCatalogInterimFixturePage();
|
||||
|
||||
expect(page.id).toBe("ak-ui-05-plugins-interim");
|
||||
expect(page.route).toBe("/mock/ak-ui-05/plugins");
|
||||
expect(page.state.status).toBe("ready");
|
||||
if (page.state.status !== "ready") throw new Error("fixture not ready");
|
||||
expect(page.state.data.designStatus).toBe("interim");
|
||||
expect(page.state.data.screenRoute).toBe("/settings/integrations/plugins");
|
||||
expect(page.state.data.viewModel.status).toBe("ready");
|
||||
|
||||
const rows = page.state.data.viewModel.data?.rows ?? [];
|
||||
expect(rows.map((row) => row.pluginId)).toEqual(["com.demo.outbound", "com.demo.workflow-hook"]);
|
||||
// The granted plugin is enabled and links into its settings UI.
|
||||
expect(rows[0]?.statusKey).toBe("shared.enabled");
|
||||
expect(rows[0]?.settingsHref).toBe("/mock/ak-ui-05/settings/integrations/plugins/pl-1");
|
||||
expect(rows[0]?.canReviewCapabilities).toBe(false);
|
||||
// The hook plugin still needs consent, so enable is folded into the grant op.
|
||||
expect(rows[1]?.statusKey).toBe("shared.disabled");
|
||||
expect(rows[1]?.canEnable).toBe(false);
|
||||
expect(rows[1]?.grantOp).toBe("grantAndEnable");
|
||||
expect(rows[1]?.capabilitiesToReview.map((capability) => capability.name)).toEqual(["hook:workflow.executed"]);
|
||||
expect(rows[1]?.capabilities[0]?.label).toEqual({
|
||||
key: "settings.plugins.consent.hookLabel",
|
||||
params: { hook: "workflow.executed" },
|
||||
});
|
||||
expect(page.registries?.breadcrumbs).toHaveLength(2);
|
||||
|
||||
const artifacts = generateMockArtifacts(page);
|
||||
expect(artifacts.module).toContain('"id": "ak-ui-05-plugins-interim"');
|
||||
expect(artifacts.module).toContain('"designStatus": "interim"');
|
||||
expect(artifacts.html).toContain('data-ui-mock-route="/mock/ak-ui-05/plugins"');
|
||||
expect(generateMockArtifacts(createPluginCatalogInterimFixturePage())).toEqual(artifacts);
|
||||
});
|
||||
|
||||
test("registers one VA-P26b hot-swap page for every real interim route", () => {
|
||||
const pages = createVaP26bInterimFixturePages();
|
||||
const registry = createMockRegistry(pages);
|
||||
const routes = [
|
||||
"/:tenant/upload",
|
||||
"/:tenant/projects/:projectId",
|
||||
"/:tenant/settings",
|
||||
"/:tenant/settings/customer-portal",
|
||||
"/:tenant/customer-portal/inbox",
|
||||
];
|
||||
|
||||
expect(pages.map((page) => page.route)).toEqual(routes);
|
||||
expect(new Set(pages.map((page) => page.id)).size).toBe(routes.length);
|
||||
for (const route of routes) expect(registry.get(route)?.route).toBe(route);
|
||||
expect(pages[0]?.state.status).toBe("ready");
|
||||
});
|
||||
|
||||
test("builds the VA-P26c domain-admin interim fixture from the pure VM builder", () => {
|
||||
const page = createVaP26cInterimFixturePage();
|
||||
|
||||
expect(page.id).toBe("va-p26c-customer-portal-domain-interim");
|
||||
expect(page.route).toBe("/:tenant/settings/customer-portal/domain");
|
||||
expect(page.state.status).toBe("ready");
|
||||
if (page.state.status !== "ready") throw new Error("fixture not ready");
|
||||
expect(page.state.data.designStatus).toBe("interim");
|
||||
expect(page.state.data.viewModel.status).toBe("ready");
|
||||
expect(page.state.data.viewModel.data?.portalEntitlementSource).toBe("base_plan");
|
||||
expect(page.state.data.viewModel.data?.domain?.status).toBe("cooldown");
|
||||
expect(page.state.data.viewModel.data?.pendingSwitch?.status).toBe("dns_verified");
|
||||
expect(page.state.data.viewModel.data?.actions.canActivateSwitch).toBe(true);
|
||||
expect(page.registries?.sidebar).toEqual([expect.objectContaining({ permission: "portal.admin" })]);
|
||||
expect(page.registries?.breadcrumbs).toHaveLength(3);
|
||||
|
||||
const artifacts = generateMockArtifacts(page);
|
||||
expect(artifacts.module).toContain('"designStatus": "interim"');
|
||||
expect(artifacts.module).toContain('"txtRecordValue": "hivegrid-verification-proof-once"');
|
||||
expect(artifacts.html).toContain('data-ui-mock-page="va-p26c-customer-portal-domain-interim"');
|
||||
expect(generateMockArtifacts(createVaP26cInterimFixturePage())).toEqual(artifacts);
|
||||
});
|
||||
|
||||
test("builds the R-P6 CRM interim fixture from the shared contact-list VM builder", () => {
|
||||
const viewModel = createCrmInterimFixtureViewModel();
|
||||
const page = createCrmInterimFixturePage();
|
||||
|
||||
expect(viewModel.status).toBe("ready");
|
||||
if (viewModel.status !== "ready") throw new Error("R-P6 CRM fixture VM must be ready");
|
||||
expect(viewModel.data.rows.map((row) => row.id)).toEqual(["kontakt-1", "kontakt-2"]);
|
||||
expect(viewModel.data.rows[0]).toMatchObject({ kontaktTyp: "privatperson", zustaendigerLabel: "Rafael Referenz" });
|
||||
expect(viewModel.data.rows[0]?.tagChips.map((tag) => tag.name)).toEqual(["VIP"]);
|
||||
expect(viewModel.data.rows[1]).toMatchObject({ kontaktTyp: "organisation", displayName: "Solaris GmbH" });
|
||||
|
||||
expect(page).toMatchObject({ id: "r-p6-crm-interim", route: "/:tenant/contacts", state: { status: "ready" } });
|
||||
if (page.state.status !== "ready") throw new Error("R-P6 CRM interim fixture must be ready");
|
||||
expect(page.state.data.designStatus).toBe("interim");
|
||||
expect(page.state.data.screenRoute).toBe("/:tenant/contacts");
|
||||
expect(page.state.data.viewModel).toEqual(viewModel);
|
||||
expect(page.state.data.cards.map((card) => card.value)).toEqual(["2", "1", "interim"]);
|
||||
expect(page.registries?.sidebar).toEqual([
|
||||
expect.objectContaining({ permission: "crm.read_own", href: "/:tenant/contacts" }),
|
||||
expect.objectContaining({ permission: "crm.read_own", href: "/:tenant/contacts/companies" }),
|
||||
]);
|
||||
expect(page.registries?.breadcrumbs).toHaveLength(1);
|
||||
|
||||
const artifacts = generateMockArtifacts(page);
|
||||
expect(artifacts.module).toContain('"id": "r-p6-crm-interim"');
|
||||
expect(artifacts.module).toContain('"designStatus": "interim"');
|
||||
expect(artifacts.html).toContain('data-ui-mock-page="r-p6-crm-interim"');
|
||||
expect(generateMockArtifacts(createCrmInterimFixturePage())).toEqual(artifacts);
|
||||
});
|
||||
|
||||
test("builds the AK-P17a HR core interim fixture and never leaks a secret value", () => {
|
||||
const page = createHrCoreInterimFixturePage();
|
||||
|
||||
expect(page).toMatchObject({ id: "ak-p17a-hr-core-interim", route: "/:tenant/hr/directory", state: { status: "ready" } });
|
||||
if (page.state.status !== "ready") throw new Error("AK-P17a HR core interim fixture must be ready");
|
||||
expect(page.state.data.designStatus).toBe("interim");
|
||||
expect(page.state.data.surfaces).toEqual(["directory", "vaultDetail"]);
|
||||
expect(page.state.data.screenRoutes).toContain("/:tenant/passwords/:vaultId");
|
||||
|
||||
const { directory, vaultDetail } = page.state.data.viewModels;
|
||||
expect(directory.status).toBe("ready");
|
||||
if (directory.status !== "ready") throw new Error("directory VM must be ready");
|
||||
expect(directory.data.rows.map((row) => row.userId)).toEqual(["user-hr-1", "user-hr-2"]);
|
||||
expect(vaultDetail.status).toBe("ready");
|
||||
if (vaultDetail.status !== "ready") throw new Error("vault VM must be ready");
|
||||
// Password-safe never-list contract: only presence flags survive into the VM.
|
||||
expect(vaultDetail.data.rows[0]).toMatchObject({ hasUsername: true, hasPassword: true, hasNotes: false });
|
||||
expect(vaultDetail.data.copyAutoClearMs).toBe(30_000);
|
||||
expect(page.state.data.cards.map((card) => card.value)).toEqual(["2", "1", "interim"]);
|
||||
expect(page.registries?.sidebar).toEqual([
|
||||
expect.objectContaining({ permission: "hr.read_own", href: "/:tenant/hr" }),
|
||||
expect.objectContaining({ permission: "hr.passwordsafe.use", href: "/:tenant/passwords" }),
|
||||
]);
|
||||
|
||||
const artifacts = generateMockArtifacts(page);
|
||||
expect(artifacts.module).toContain('"id": "ak-p17a-hr-core-interim"');
|
||||
expect(artifacts.module).toContain('"hasPassword": true');
|
||||
expect(artifacts.module).not.toMatch(/"username"|"password":|"notes":/);
|
||||
expect(artifacts.html).toContain('data-ui-mock-page="ak-p17a-hr-core-interim"');
|
||||
expect(generateMockArtifacts(createHrCoreInterimFixturePage())).toEqual(artifacts);
|
||||
});
|
||||
|
||||
test("builds the AK-P17b HR leave workflow interim fixture from the shared leave VM builders", () => {
|
||||
const page = createHrWorkflowsInterimFixturePage();
|
||||
|
||||
expect(page).toMatchObject({ id: "ak-p17b-hr-leave-interim", route: "/:tenant/hr/leave", state: { status: "ready" } });
|
||||
if (page.state.status !== "ready") throw new Error("AK-P17b HR leave interim fixture must be ready");
|
||||
expect(page.state.data.designStatus).toBe("interim");
|
||||
expect(page.state.data.screenRoute).toBe("/:tenant/hr/leave");
|
||||
|
||||
const { leaveOwn, leaveApprovals } = page.state.data.viewModels;
|
||||
expect(leaveOwn.status).toBe("ready");
|
||||
if (leaveOwn.status !== "ready") throw new Error("own-leave VM must be ready");
|
||||
// The builder derives label keys and the withdraw capability from status.
|
||||
expect(leaveOwn.data.rows[0]).toMatchObject({ statusLabelKey: "hr.leave.status.submitted", canWithdraw: true });
|
||||
expect(leaveOwn.data.rows[1]).toMatchObject({ statusLabelKey: "hr.leave.status.approved", canWithdraw: false });
|
||||
expect(leaveApprovals.status).toBe("ready");
|
||||
if (leaveApprovals.status !== "ready") throw new Error("approver VM must be ready");
|
||||
expect(leaveApprovals.data.rows[0]).toMatchObject({ hasConflict: true, conflictCount: 1, kindLabelKey: "hr.leave.kind.vacation" });
|
||||
expect(page.state.data.cards.map((card) => card.value)).toEqual(["2", "1", "interim"]);
|
||||
|
||||
const artifacts = generateMockArtifacts(page);
|
||||
expect(artifacts.module).toContain('"id": "ak-p17b-hr-leave-interim"');
|
||||
expect(artifacts.module).toContain('"hasConflict": true');
|
||||
expect(artifacts.html).toContain('data-ui-mock-page="ak-p17b-hr-leave-interim"');
|
||||
expect(generateMockArtifacts(createHrWorkflowsInterimFixturePage())).toEqual(artifacts);
|
||||
});
|
||||
|
||||
test("builds the R-P7 lead-inbox interim fixture from the shared lead-list VM builder", () => {
|
||||
const viewModel = createLeadInterimFixtureViewModel();
|
||||
const page = createLeadInterimFixturePage();
|
||||
|
||||
expect(viewModel.status).toBe("ready");
|
||||
if (viewModel.status !== "ready") throw new Error("R-P7 lead fixture VM must be ready");
|
||||
expect(viewModel.data.rows.map((row) => row.id)).toEqual(["lead-1", "lead-2", "lead-3"]);
|
||||
// The three triage markers each appear once in the fixture.
|
||||
expect(viewModel.data.rows[0]?.markers).toEqual(["duplicate"]);
|
||||
expect(viewModel.data.rows[1]).toMatchObject({ status: "qualified", zustaendigerLabel: "Rafael Referenz", weiterverarbeitungFreigabe: "ja" });
|
||||
expect(viewModel.data.rows[2]?.markers).toEqual(["spam"]);
|
||||
expect(viewModel.data.rows[1]?.displayName).toBe("+49 30 5556677");
|
||||
|
||||
expect(page).toMatchObject({ id: "r-p7-leads-interim", route: "/:tenant/leads", state: { status: "ready" } });
|
||||
if (page.state.status !== "ready") throw new Error("R-P7 lead interim fixture must be ready");
|
||||
expect(page.state.data.designStatus).toBe("interim");
|
||||
expect(page.state.data.screenRoute).toBe("/:tenant/leads");
|
||||
expect(page.state.data.viewModel).toEqual(viewModel);
|
||||
expect(page.state.data.cards.map((card) => card.value)).toEqual(["3", "2", "interim"]);
|
||||
expect(page.registries?.sidebar).toEqual([
|
||||
expect.objectContaining({ permission: "leads.read_own", href: "/:tenant/leads" }),
|
||||
expect.objectContaining({ permission: "leads.read_own", href: "/:tenant/leads-statistics" }),
|
||||
]);
|
||||
expect(page.registries?.breadcrumbs).toHaveLength(1);
|
||||
|
||||
const artifacts = generateMockArtifacts(page);
|
||||
expect(artifacts.module).toContain('"id": "r-p7-leads-interim"');
|
||||
expect(artifacts.module).toContain('"designStatus": "interim"');
|
||||
expect(artifacts.html).toContain('data-ui-mock-page="r-p7-leads-interim"');
|
||||
expect(generateMockArtifacts(createLeadInterimFixturePage())).toEqual(artifacts);
|
||||
});
|
||||
|
||||
test("builds the R-P8 pipeline-kanban interim fixture from the shared kanban VM builder", () => {
|
||||
const viewModel = createProjektBoardInterimFixtureViewModel();
|
||||
const page = createProjektBoardInterimFixturePage();
|
||||
|
||||
expect(viewModel.status).toBe("ready");
|
||||
if (viewModel.status !== "ready") throw new Error("R-P8 kanban fixture VM must be ready");
|
||||
expect(viewModel.data.columns.map((column) => column.stageId)).toEqual(["stage-neu", "stage-angebot", "stage-gewonnen", "stage-verloren"]);
|
||||
// Field-level gating: the second column and its card hide the volume.
|
||||
expect(viewModel.data.columns[1]).toMatchObject({ aggregateVisible: false, aggregateValue: null });
|
||||
expect(viewModel.data.columns[1]?.cards[0]).toMatchObject({ valueVisible: false, value: null, isStuck: true });
|
||||
expect(viewModel.data.columns[0]?.cards[0]).toMatchObject({ projektNummer: "P-00001", ownerLabel: "Rafael Referenz" });
|
||||
expect(viewModel.data.openStages.map((stage) => stage.id)).toEqual(["stage-neu", "stage-angebot"]);
|
||||
expect(viewModel.data.wonStageId).toBe("stage-gewonnen");
|
||||
expect(viewModel.data.lostStageId).toBe("stage-verloren");
|
||||
expect(viewModel.data.lostReasons).toHaveLength(2);
|
||||
expect(viewModel.data.sseHref).toBe("/:tenant/projects/pipelines/pipeline-sales/stream");
|
||||
|
||||
expect(page).toMatchObject({ id: "r-p8-projects-interim", route: "/:tenant/projects", state: { status: "ready" } });
|
||||
if (page.state.status !== "ready") throw new Error("R-P8 kanban interim fixture must be ready");
|
||||
expect(page.state.data.designStatus).toBe("interim");
|
||||
expect(page.state.data.screenRoute).toBe("/:tenant/projects");
|
||||
expect(page.state.data.viewModel).toEqual(viewModel);
|
||||
expect(page.state.data.cards.map((card) => card.value)).toEqual(["4", "3", "interim"]);
|
||||
expect(page.registries?.sidebar).toEqual([
|
||||
expect.objectContaining({ permission: "projects.read_own", href: "/:tenant/projects" }),
|
||||
expect.objectContaining({ permission: "projects.read_own", href: "/:tenant/projects/list" }),
|
||||
]);
|
||||
expect(page.registries?.breadcrumbs).toHaveLength(1);
|
||||
|
||||
const artifacts = generateMockArtifacts(page);
|
||||
expect(artifacts.module).toContain('"id": "r-p8-projects-interim"');
|
||||
expect(artifacts.module).toContain('"designStatus": "interim"');
|
||||
expect(artifacts.html).toContain('data-ui-mock-page="r-p8-projects-interim"');
|
||||
expect(generateMockArtifacts(createProjektBoardInterimFixturePage())).toEqual(artifacts);
|
||||
});
|
||||
|
||||
test("builds the R-P9 operations interim fixture from the shared operations VM builders", () => {
|
||||
const viewModels = createProjektOperationsInterimFixtureViewModels();
|
||||
const page = createProjektOperationsInterimFixturePage();
|
||||
|
||||
expect(viewModels.plantafel.status).toBe("ready");
|
||||
if (viewModels.plantafel.status !== "ready") throw new Error("R-P9 plantafel fixture VM must be ready");
|
||||
expect(viewModels.plantafel.data.totalEntries).toBe(2);
|
||||
expect(viewModels.plantafel.data.conflictCount).toBe(1);
|
||||
expect(viewModels.plantafel.data.absencesCount).toBe(1);
|
||||
expect(viewModels.plantafel.data.entries.map((entry) => entry.id)).toEqual(["schedule-1", "schedule-2"]);
|
||||
|
||||
expect(viewModels.acceptanceList.status).toBe("ready");
|
||||
if (viewModels.acceptanceList.status !== "ready") throw new Error("R-P9 acceptance fixture VM must be ready");
|
||||
expect(viewModels.acceptanceList.data.projectNumber).toBe("P-2026-0001");
|
||||
expect(viewModels.acceptanceList.data.protocols).toHaveLength(1);
|
||||
expect(viewModels.acceptanceList.data.protocols[0]).toMatchObject({
|
||||
kind: "with_defects",
|
||||
statusLabelKey: "projects.acceptance.status.locked",
|
||||
signatureCount: 2,
|
||||
});
|
||||
|
||||
expect(viewModels.subAreas.status).toBe("ready");
|
||||
if (viewModels.subAreas.status !== "ready") throw new Error("R-P9 sub-areas fixture VM must be ready");
|
||||
expect(viewModels.subAreas.data.openDefects).toBe(1);
|
||||
expect(viewModels.subAreas.data.requiresAcceptanceProtocol).toBe(true);
|
||||
expect(viewModels.subAreas.data.acceptanceHref).toBe("/:tenant/projects/project-1/acceptance");
|
||||
expect(viewModels.subAreas.data.chat).toBeNull();
|
||||
expect(viewModels.subAreas.data.tasks).toHaveLength(1);
|
||||
expect(viewModels.subAreas.data.documents[0]?.linkRole).toBe("acceptance_protocol");
|
||||
expect(viewModels.subAreas.data.groupOptions).toEqual([{ id: "group-1", name: "Montage-Team" }]);
|
||||
|
||||
expect(page).toMatchObject({ id: "r-p9-operations-interim", route: "/:tenant/projects/plantafel", state: { status: "ready" } });
|
||||
if (page.state.status !== "ready") throw new Error("R-P9 operations interim fixture must be ready");
|
||||
expect(page.state.data.designStatus).toBe("interim");
|
||||
expect(page.state.data.screenRoute).toBe("/:tenant/projects/plantafel");
|
||||
expect(page.state.data.viewModels).toEqual(viewModels);
|
||||
expect(page.state.data.cards.map((card) => card.value)).toEqual(["2", "1", "interim"]);
|
||||
expect(page.registries?.sidebar).toEqual([expect.objectContaining({ permission: "plantafel.read_own", href: "/:tenant/projects/plantafel" })]);
|
||||
expect(page.registries?.breadcrumbs).toHaveLength(1);
|
||||
|
||||
const artifacts = generateMockArtifacts(page);
|
||||
expect(artifacts.module).toContain('"id": "r-p9-operations-interim"');
|
||||
expect(artifacts.module).toContain('"designStatus": "interim"');
|
||||
expect(artifacts.html).toContain('data-ui-mock-page="r-p9-operations-interim"');
|
||||
expect(generateMockArtifacts(createProjektOperationsInterimFixturePage())).toEqual(artifacts);
|
||||
});
|
||||
|
||||
test("keeps visual snapshots stable for equivalent mock page input", () => {
|
||||
const page = createHotSwapDrillPage();
|
||||
const reorderedPage = createMockPage({
|
||||
@@ -46,4 +492,227 @@ describe("@hivegrid/ui-mock", () => {
|
||||
expect(generateMockPageHtml(reorderedPage)).toBe(generateMockPageHtml(page));
|
||||
expect(createVisualSnapshot(reorderedPage)).toEqual(createVisualSnapshot(page));
|
||||
});
|
||||
|
||||
test("builds the AK-P20 interim fixture from all five screen view models", () => {
|
||||
const page = createP20InterimFixturePage({
|
||||
subscription: buildSubscriptionOverviewVM({
|
||||
hasSubscription: true,
|
||||
status: "active",
|
||||
planCode: "starter",
|
||||
seatUsage: buildSeatUsageVM({ packageId: null, usage: null, counts: { office: 3, field: 2 } }),
|
||||
products: [],
|
||||
entitlements: [],
|
||||
canCancel: true,
|
||||
contactHref: "https://example.test/contact",
|
||||
}),
|
||||
usage: buildBillingUsageVM({
|
||||
periodStart: "2026-07-01T00:00:00.000Z",
|
||||
periodEnd: "2026-08-01T00:00:00.000Z",
|
||||
metrics: [{ metricCode: "automation_runs", quantity: 42, quota: 100, remaining: 58, exceeded: false, percentUsed: 42 }],
|
||||
}),
|
||||
billing: buildBillingPaymentVM({
|
||||
invoices: [
|
||||
{
|
||||
id: "invoice-1",
|
||||
number: "2026-001",
|
||||
issuingDate: "2026-07-01T00:00:00.000Z",
|
||||
amountCents: 9900,
|
||||
currency: "eur",
|
||||
status: "finalized",
|
||||
paymentStatus: "paid",
|
||||
invoiceType: "subscription",
|
||||
downloadHref: "/:tenant/settings/billing/invoices/invoice-1",
|
||||
},
|
||||
],
|
||||
lastPaymentExternalId: "mollie-payment-1",
|
||||
}),
|
||||
demoData: toDemoDataSettingsVM({
|
||||
demoDataUiEnabled: true,
|
||||
provisioning: {
|
||||
id: "demo-1",
|
||||
entitiesCreated: { kontakt: ["contact-1"], projekt: ["project-1"], task: ["task-1"] },
|
||||
createdAt: "2026-07-01T00:00:00.000Z",
|
||||
},
|
||||
}),
|
||||
checklist: toFirstStepsChecklistVM({
|
||||
id: "checklist-1",
|
||||
status: "active",
|
||||
dismissed: false,
|
||||
items: [
|
||||
{ id: "profile", block: "profile", titleKey: "onboarding.firstSteps.profile", href: "/:tenant/settings/profile", completed: true },
|
||||
{ id: "project", block: "project", titleKey: "onboarding.firstSteps.project", href: "/:tenant/projects", completed: false },
|
||||
],
|
||||
}),
|
||||
});
|
||||
const artifacts = generateMockArtifacts(page);
|
||||
|
||||
expect(page.state.status).toBe("ready");
|
||||
if (page.state.status !== "ready") throw new Error("AK-P20 interim fixture must be ready");
|
||||
expect(page.state.data.viewModels.checklist).toMatchObject({
|
||||
status: "ready",
|
||||
data: { completedCount: 1, totalCount: 2 },
|
||||
});
|
||||
expect(page.state.data.screenRoutes).toHaveLength(5);
|
||||
expect(artifacts.module).toContain('"designStatus": "interim"');
|
||||
expect(artifacts.html).toContain('data-ui-mock-page="ak-p20-interim"');
|
||||
expect(artifacts.html).toContain("/:tenant/settings/workspace/demo-data");
|
||||
expect(artifacts.snapshot).toMatchObject({
|
||||
pageId: "ak-p20-interim",
|
||||
route: "/:tenant/settings/billing",
|
||||
status: "ready",
|
||||
metrics: { sidebarItems: 5, breadcrumbItems: 2, mobileItems: 0, portalItems: 0 },
|
||||
});
|
||||
});
|
||||
|
||||
test("builds the VA-P24a interim fixture from the shared self-service subscription VM", () => {
|
||||
const viewModel = createVaP24aInterimFixtureViewModel();
|
||||
const page = createVaP24aInterimFixturePage();
|
||||
const artifacts = generateMockArtifacts(page);
|
||||
|
||||
expect(viewModel.overview).toMatchObject({ status: "ready", data: { planCode: "starter" } });
|
||||
expect(viewModel.catalog.plans.map((plan) => plan.code)).toEqual(["starter", "business"]);
|
||||
expect(viewModel.catalog.plans.flatMap((plan) => plan.prices)).toHaveLength(4);
|
||||
expect(viewModel).toMatchObject({
|
||||
minimumSeatQuantity: 3,
|
||||
canManage: true,
|
||||
billingHref: "/:tenant/settings/billing",
|
||||
trialPolicy: { requiresManualActivation: false, requiresPaymentMethod: true },
|
||||
});
|
||||
|
||||
expect(page).toMatchObject({ id: "va-p24a-interim", route: "/:tenant/settings/billing", state: { status: "ready" } });
|
||||
if (page.state.status !== "ready") throw new Error("VA-P24a interim fixture must be ready");
|
||||
expect(page.state.data).toMatchObject({
|
||||
designStatus: "interim",
|
||||
screenRoute: "/:tenant/settings/billing",
|
||||
viewModel: { minimumSeatQuantity: 3, canManage: true },
|
||||
});
|
||||
expect(artifacts.module).toContain('"designStatus": "interim"');
|
||||
expect(artifacts.html).toContain('data-ui-mock-page="va-p24a-interim"');
|
||||
expect(artifacts.snapshot).toMatchObject({
|
||||
pageId: "va-p24a-interim",
|
||||
route: "/:tenant/settings/billing",
|
||||
status: "ready",
|
||||
metrics: { sidebarItems: 1, breadcrumbItems: 2, mobileItems: 0, portalItems: 0 },
|
||||
});
|
||||
expect(generateMockArtifacts(createVaP24aInterimFixturePage())).toEqual(artifacts);
|
||||
});
|
||||
|
||||
test("builds the VA-P26a interim fixture from the access-scoped portal dashboard VM", () => {
|
||||
const viewModel = createVaP26aInterimFixtureViewModel();
|
||||
const page = createVaP26aInterimFixturePage();
|
||||
const artifacts = generateMockArtifacts(page);
|
||||
|
||||
expect(viewModel).toMatchObject({
|
||||
status: "ready",
|
||||
data: {
|
||||
portalName: "Acme Kundenportal",
|
||||
viewerLabel: "Karla Kunde",
|
||||
frozen: false,
|
||||
},
|
||||
});
|
||||
expect(page).toMatchObject({
|
||||
id: "va-p26a-customer-portal-interim",
|
||||
route: "/:tenant",
|
||||
state: { status: "ready" },
|
||||
});
|
||||
if (page.state.status !== "ready") throw new Error("VA-P26a interim fixture must be ready");
|
||||
expect(page.state.data.screenRoutes).toEqual(["/:tenant", "/:tenant/projects", "/:tenant/projects/:projectId"]);
|
||||
expect(page.state.data.viewModel).toEqual(viewModel);
|
||||
expect(artifacts.module).toContain('"designStatus": "interim"');
|
||||
expect(artifacts.html).toContain('data-ui-mock-page="va-p26a-customer-portal-interim"');
|
||||
expect(artifacts.snapshot).toMatchObject({
|
||||
pageId: "va-p26a-customer-portal-interim",
|
||||
route: "/:tenant",
|
||||
status: "ready",
|
||||
metrics: { sidebarItems: 2, breadcrumbItems: 2, mobileItems: 0, portalItems: 1 },
|
||||
});
|
||||
expect(generateMockArtifacts(createVaP26aInterimFixturePage())).toEqual(artifacts);
|
||||
});
|
||||
|
||||
test("builds the AK-P15a telephony interim fixture from credential-free view models", () => {
|
||||
const page = createTelephonyInterimFixturePage();
|
||||
const artifacts = generateMockArtifacts(page);
|
||||
|
||||
expect(page.state.status).toBe("ready");
|
||||
if (page.state.status !== "ready") throw new Error("AK-P15a telephony interim fixture must be ready");
|
||||
expect(page.state.data.designStatus).toBe("interim");
|
||||
expect(page.state.data.surfaces).toEqual(["settings", "calls", "callDetail", "clickToCall"]);
|
||||
expect(page.state.data.viewModels.settings).toMatchObject({
|
||||
status: "ready",
|
||||
data: { connection: { provider: "aircall", status: "active" } },
|
||||
});
|
||||
expect(page.state.data.viewModels.calls).toMatchObject({ status: "ready", data: { canReadAll: true } });
|
||||
expect(page.state.data.viewModels.callDetail).toMatchObject({ status: "ready", data: { id: "call-1" } });
|
||||
expect(page.state.data.viewModels.clickToCall).toMatchObject({ mode: "provider", requiresSelection: true });
|
||||
expect(JSON.stringify(page.state.data.viewModels)).not.toMatch(/accessToken|refreshToken|clientSecret/i);
|
||||
expect(artifacts.module).toContain('"designStatus": "interim"');
|
||||
expect(artifacts.html).toContain('data-ui-mock-page="ak-p15a-telephony-interim"');
|
||||
expect(artifacts.snapshot).toMatchObject({
|
||||
pageId: "ak-p15a-telephony-interim",
|
||||
route: "/:tenant/calls",
|
||||
status: "ready",
|
||||
metrics: { sidebarItems: 2, breadcrumbItems: 2, mobileItems: 0, portalItems: 0 },
|
||||
});
|
||||
});
|
||||
|
||||
test("builds deterministic AK-P15b chat index and detail fixtures from the shared view models", () => {
|
||||
const indexPage = createChatIndexInterimFixturePage();
|
||||
const detailPage = createChatDetailInterimFixturePage();
|
||||
|
||||
expect(indexPage.state.status).toBe("ready");
|
||||
expect(detailPage.state.status).toBe("ready");
|
||||
if (indexPage.state.status !== "ready" || detailPage.state.status !== "ready") {
|
||||
throw new Error("AK-P15b chat interim fixtures must be ready");
|
||||
}
|
||||
const indexViewModel = indexPage.state.data.viewModel;
|
||||
const detailViewModel = detailPage.state.data.viewModel;
|
||||
if (indexViewModel.status !== "ready" || detailViewModel.status !== "ready") {
|
||||
throw new Error("AK-P15b shared chat view models must be ready");
|
||||
}
|
||||
|
||||
expect(indexPage.state.data).toMatchObject({
|
||||
designStatus: "interim",
|
||||
screenRoute: "/chat",
|
||||
viewModel: {
|
||||
status: "ready",
|
||||
data: {
|
||||
totals: { unread: 3, mentions: 1 },
|
||||
permissions: { canDiscover: true, canSearch: true },
|
||||
},
|
||||
},
|
||||
});
|
||||
expect(indexViewModel.data.rows.map((row) => row.id)).toEqual(["chat-group-montage", "chat-dm-mara"]);
|
||||
expect(indexViewModel.data.rows[0]).toMatchObject({ hasUnread: true, hasMention: true, isPinned: true });
|
||||
expect(indexViewModel.data.rows[1]).toMatchObject({ kind: "dm", isMuted: true });
|
||||
expect(indexViewModel.data.discoverRows).toEqual([
|
||||
expect.objectContaining({ id: "chat-public-service", joinHref: "/:tenant/chat", detailHref: null, canJoin: true }),
|
||||
]);
|
||||
expect(indexPage.registries?.sidebar).toEqual([expect.objectContaining({ permission: "chat.read_own_channels", href: "/:tenant/chat" })]);
|
||||
|
||||
expect(detailPage.state.data).toMatchObject({
|
||||
designStatus: "interim",
|
||||
screenRoute: "/chat/:id",
|
||||
viewModel: {
|
||||
status: "ready",
|
||||
data: {
|
||||
connection: { state: "online", canRetry: false },
|
||||
composer: { enabled: true, canAttachFiles: false },
|
||||
history: { olderCursor: "cursor-message-older", hasOlder: true },
|
||||
},
|
||||
},
|
||||
});
|
||||
// The local echo and the canonical HTTP acknowledgement share one client id
|
||||
// and therefore collapse into a single sent message in the fixture VM.
|
||||
expect(detailViewModel.data.messages).toHaveLength(2);
|
||||
expect(detailViewModel.data.messages[1]).toMatchObject({
|
||||
id: "message-raffael-1",
|
||||
clientMessageId: "client-raffael-1",
|
||||
source: "http_ack",
|
||||
deliveryState: "sent",
|
||||
});
|
||||
expect(detailPage.registries?.breadcrumbs).toHaveLength(2);
|
||||
|
||||
expect(generateMockArtifacts(createChatIndexInterimFixturePage())).toEqual(generateMockArtifacts(indexPage));
|
||||
expect(generateMockArtifacts(createChatDetailInterimFixturePage())).toEqual(generateMockArtifacts(detailPage));
|
||||
});
|
||||
});
|
||||
File diff suppressed because it is too large.
Load diff
+2
-2
@@ -18,7 +18,7 @@ const model: IntegrationCatalogModel = {
|
||||
categoryKey: "integrations.category.erp",
|
||||
connectionType: "rest_api",
|
||||
connectionCount: 2,
|
||||
detailHref: "/acme/integrations/sample-data-sync",
|
||||
detailHref: "/acme/settings/integrations/sample-data-sync",
|
||||
},
|
||||
{
|
||||
key: "gmail",
|
||||
@@ -27,7 +27,7 @@ const model: IntegrationCatalogModel = {
|
||||
categoryKey: "integrations.category.communication",
|
||||
connectionType: "oauth2",
|
||||
connectionCount: 0,
|
||||
detailHref: "/acme/integrations/gmail",
|
||||
detailHref: "/acme/settings/integrations/gmail",
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
+1
@@ -15,6 +15,7 @@ const model: MembersListModel = {
|
||||
name: "Ada Lovelace",
|
||||
email: "ada@example.test",
|
||||
statusLabelKey: "settings.members.status.active",
|
||||
seatLabelKey: "settings.members.seat.office",
|
||||
mfaEnabled: true,
|
||||
roleNames: ["Monteur"],
|
||||
canDeactivate: true,
|
||||
|
||||
Reference in new issue
Block a user