import { expect, test } from "vitest"; import { formatDate } from "./format-date"; test("formats a date-only string in the locale without a timezone day-shift", () => { expect(formatDate("1962-04-03", "en")).toBe("Apr 3, 1962"); }); test("returns the em-dash placeholder for null", () => { expect(formatDate(null, "en")).toBe("—"); }); test("returns an unparseable string unchanged", () => { expect(formatDate("not-a-date", "en")).toBe("not-a-date"); }); test("stringifies a non-string, non-null value", () => { expect(formatDate(42, "en")).toBe("42"); });