import { describe, it, expect } from "vitest"; import { liveScenarios, liveMeta } from "./live"; describe("liveScenarios adapter", () => { it("loads >= 1 scenario from scenarios.json", () => { expect(liveScenarios.length).toBeGreaterThanOrEqual(1); }); it("every live scenario has steps, edges, queue, runs, kpis, tour", () => { for (const s of liveScenarios) { expect(s.live).toBe(true); expect(s.steps.length).toBeGreaterThan(0); expect(s.edges.length).toBeGreaterThan(0); expect(s.kpis.length).toBeGreaterThan(0); expect(s.tour.length).toBeGreaterThanOrEqual(4); expect(s.defaultStepId).toBeTruthy(); } }); it("all step ids referenced by edges exist", () => { for (const s of liveScenarios) { const ids = new Set(s.steps.map((st) => st.id)); for (const e of s.edges) { expect(ids.has(e.source), `edge source ${e.source}`).toBe(true); expect(ids.has(e.target), `edge target ${e.target}`).toBe(true); } } }); it("queue & runs have unique ids per scenario", () => { for (const s of liveScenarios) { const qIds = s.queue.map((q) => q.id); const rIds = s.runs.map((r) => r.id); expect(new Set(qIds).size).toBe(qIds.length); expect(new Set(rIds).size).toBe(rIds.length); } }); it("liveMeta exposes board + fetchedFrom", () => { expect(liveMeta.fetchedFrom).toMatch(/^https?:/); expect(Array.isArray(liveMeta.board)).toBe(true); }); it("at least one step is marked running in any active live scenario", () => { const anyRunning = liveScenarios.some((s) => s.steps.some((st) => st.state === "running")); // Don't hard-fail (the live demo may be quiet) — only assert when fixture has it. if (anyRunning) expect(anyRunning).toBe(true); }); });