import { describe, expect, it } from "vitest"; import { fmtDateRange, fmtShortDate, rangeDayCount, } from "@/domain/work-orders/utils/wizard-date-utils"; describe("fmtShortDate", () => { it("formats ISO dates as Mon D", () => { expect(fmtShortDate("2026-06-08")).toBe("Jun 8"); }); it("returns em dash for invalid input", () => { expect(fmtShortDate("")).toBe("—"); expect(fmtShortDate("nope")).toBe("—"); }); }); describe("fmtDateRange", () => { it("joins start and end with en dash", () => { expect(fmtDateRange("2026-06-08", "2026-06-12")).toBe("Jun 8 – Jun 12"); }); }); describe("rangeDayCount", () => { it("counts inclusive days order-independently", () => { expect(rangeDayCount("2026-06-08", "2026-06-12")).toBe(5); expect(rangeDayCount("2026-06-12", "2026-06-08")).toBe(5); expect(rangeDayCount("2026-06-08", "2026-06-08")).toBe(1); }); });