- Enhanced `nss-fasteners-pb-import.json` to compute `selling_price` as `cost_price * (1 + 80%)` and included `markup` in the records. - Updated `nss-fasteners-pb-transform.ts` to allow configurable CSV and output file names via environment variables, improving flexibility for different product runs. - Added support for uploading photos in the repair detail page, including validation for file types and sizes, and implemented a dialog for creating customer quotes linked to repairs. - Introduced a new `customer_quote` field in the `Repair` type to link generated quotes back to their respective repairs. These changes streamline the pricing process and enhance the user experience in managing repairs and quotes.
52 lines
1.6 KiB
TypeScript
52 lines
1.6 KiB
TypeScript
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);
|
|
});
|
|
});
|