40 lines
1.8 KiB
TypeScript
40 lines
1.8 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { createMockPage, generateMockArtifacts } from "@toolctrl/ui-mock";
|
|
import { buildWalkingSkeletonVM } from "@toolctrl/view-models";
|
|
import { WALKING_SKELETON_MODULE_KEY } from "./constants";
|
|
|
|
/**
|
|
* Hot-Swap-/ui-mock-Smoke (R-P1c): das Walking-Skeleton-VM muss sich ohne Logik-Bruch gegen
|
|
* `packages/ui-mock` als Drop-in rendern lassen. Beweist, dass der Loader-Output (VM) die
|
|
* Hot-Swap-Konvention erfüllt (serialisierbar, i18n-Keys statt Klartext).
|
|
*/
|
|
describe("walking-skeleton renders as a ui-mock drop-in", () => {
|
|
it("produces hot-swap module + html + snapshot for the active VM", () => {
|
|
const vm = buildWalkingSkeletonVM({ tenantId: "t1", moduleKey: WALKING_SKELETON_MODULE_KEY, connectorState: "active" });
|
|
const page = createMockPage({
|
|
id: "walking-skeleton",
|
|
route: "/app/:tenant/walking-skeleton",
|
|
titleKey: "walkingSkeleton.title",
|
|
state: vm,
|
|
});
|
|
|
|
const artifacts = generateMockArtifacts(page);
|
|
|
|
expect(artifacts.module).toContain("export const mockPage");
|
|
expect(artifacts.html).toContain("walking-skeleton");
|
|
expect(artifacts.snapshot.status).toBe("ready");
|
|
expect(artifacts.snapshot.route).toBe("/app/:tenant/walking-skeleton");
|
|
expect(artifacts.snapshot.htmlHash).toMatch(/^[0-9a-f]+$/);
|
|
});
|
|
|
|
it("keeps the locked VM swappable (graceful upsell state)", () => {
|
|
const vm = buildWalkingSkeletonVM({ tenantId: "t1", moduleKey: WALKING_SKELETON_MODULE_KEY, connectorState: "locked" });
|
|
const page = createMockPage({ id: "walking-skeleton-locked", route: "/app/:tenant/walking-skeleton", state: vm });
|
|
|
|
const artifacts = generateMockArtifacts(page);
|
|
|
|
expect(artifacts.snapshot.status).toBe("ready");
|
|
expect(artifacts.module).toContain("export const mockPage");
|
|
});
|
|
});
|