14 lines
1.3 KiB
TypeScript
14 lines
1.3 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { isSnapshotStale, routeTitle } from "../src/contracts";
|
|
import { formatBrusselsTime, healthLabel } from "../src/format";
|
|
|
|
describe("management shell contracts", () => {
|
|
it("labels connector detail breadcrumbs as a registered route", () => {
|
|
expect(routeTitle("/connectors/knowledge-default")).toBe("Connector detail");
|
|
expect(routeTitle("/connectors/knowledge-default/")).toBe("Connector detail");
|
|
});
|
|
it("maps required routes to stable titles", () => { expect(routeTitle("/")).toBe("Overview"); expect(routeTitle("/projects/ludarium")).toBe("Project detail"); expect(routeTitle("/audit")).toBe("Audit"); expect(routeTitle("/missing")).toBe("Not found"); });
|
|
it("marks invalid and old snapshots stale instead of implying health", () => { const snapshot = { generatedAt: "2026-08-01T10:00:00Z", staleAfterSeconds: 30 } as Parameters<typeof isSnapshotStale>[0]; expect(isSnapshotStale(snapshot, Date.parse("2026-08-01T10:00:31Z"))).toBe(true); expect(isSnapshotStale({ ...snapshot, generatedAt: "not-a-date" })).toBe(true); });
|
|
it("formats operator times in Brussels and labels state textually", () => { expect(formatBrusselsTime("2026-08-01T10:00:00Z")).toContain("12:00"); expect(formatBrusselsTime(null)).toBe("Never recorded"); expect(healthLabel("unavailable")).toBe("Unavailable"); });
|
|
});
|