WFDASH-WEBAPP/src/lib/repair-document-stage.test.ts

53 lines
1.6 KiB
TypeScript
Raw Normal View History

import { describe, it, expect } from "vitest";
import { documentStageStyle } from "@/lib/repair-document-stage";
describe("documentStageStyle", () => {
it("returns the four tones with the right label and Tailwind classes", () => {
const cases = [
{
tone: "pending" as const,
label: "Not started",
stripe: "bg-red-500",
badge: "bg-red-100 text-red-700 ring-red-600/20",
},
{
tone: "in_progress" as const,
label: "In progress",
stripe: "bg-amber-500",
badge: "bg-amber-100 text-amber-800 ring-amber-600/20",
},
{
tone: "done" as const,
label: "Done",
stripe: "bg-emerald-500",
badge: "bg-emerald-100 text-emerald-800 ring-emerald-600/20",
},
{
tone: "skipped" as const,
label: "Replaced",
stripe: "bg-zinc-300",
badge: "bg-zinc-100 text-zinc-600 ring-zinc-500/20",
},
];
for (const c of cases) {
const s = documentStageStyle(c.tone);
expect(s.tone).toBe(c.tone);
expect(s.label).toBe(c.label);
expect(s.stripeClass).toBe(c.stripe);
expect(s.badgeClass).toBe(c.badge);
// Every tone exposes the same five keys so the consumer can
// splat the result onto a row.
expect(s.dotClass).toMatch(/^bg-/);
expect(s.tintClass).toMatch(/^bg-/);
}
});
it("returns a fresh object per call (no shared mutable state)", () => {
const a = documentStageStyle("done");
const b = documentStageStyle("done");
expect(a).not.toBe(b);
expect(a).toEqual(b);
});
});