feat(web): Pressing Plant component library + describeJob
design.css component classes (masthead, contents nav, tiles, dept header, job row + severity stripe, status chip, progress bar, pressed list, buttons, fields). Presentational _ui components. describeJob maps worker Job.state to literal labels + severity kind + stepped progress (unit-tested). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
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);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user