import { describe, it, expect } from "vitest"; import { describeJob } from "./status"; describe("describeJob", () => { it("maps pipeline states to literal labels + severity kind", () => { expect(describeJob("requested", "intake")).toMatchObject({ label: "Queued", kind: "idle" }); expect(describeJob("matching", "match")).toMatchObject({ label: "Searching", kind: "working" }); expect(describeJob("downloading", "download")).toMatchObject({ label: "Downloading", kind: "working" }); expect(describeJob("tagging", "tag")).toMatchObject({ label: "Tagging", kind: "verify" }); expect(describeJob("imported", "import")).toMatchObject({ label: "Pressed", kind: "done" }); expect(describeJob("needs_attention", "download")).toMatchObject({ label: "Needs attention", kind: "attention" }); }); it("derives a stepped progress from the pipeline stage", () => { expect(describeJob("downloading", "download")).toMatchObject({ step: 4, totalSteps: 6 }); expect(describeJob("matching", "intake")).toMatchObject({ step: 1, totalSteps: 6 }); }); it("falls back gracefully for unknown states/stages", () => { expect(describeJob("weird", "intake").kind).toBe("idle"); expect(describeJob("weird", "intake").label).toBe("Weird"); expect(describeJob("downloading", "???").step).toBe(0); }); });