import { describe, it, expect } from "vitest"; import { tEn } from "@/test/i18nCatalog"; import { TRXN_LABEL, formatDate, nextDay } from "./giftCardLabels"; describe("giftCardLabels", () => { it("formats dates as d MMM yyyy", () => { expect(formatDate("2029-10-06")).toBe("6 Oct 2029"); expect(formatDate("2026-10-06T09:00:00")).toBe("6 Oct 2026"); expect(formatDate(null)).toBe("—"); }); it("nextDay gives the earliest allowed new expiry", () => { expect(nextDay("2029-10-06")).toBe("2029-10-07"); expect(nextDay("2029-12-31")).toBe("2030-01-01"); expect(nextDay("2028-02-28")).toBe("2028-02-29"); }); it("labels both adjustment directions", () => { expect(tEn(TRXN_LABEL.ADJUST_IN)).toBe("Adjustment in"); expect(tEn(TRXN_LABEL.ADJUST_OUT)).toBe("Adjustment out"); }); });