UNPKG

@crossed/ui

Version:

A universal & performant styling library for React Native, Next.js & React

47 lines (46 loc) 1.84 kB
var import_utils = require("../utils"); describe("Date Utilities", () => { describe("getSeparator", () => { it("should return the separator used in French locale", () => { const result = (0, import_utils.getSeparator)("fr"); expect(result).toBe("/"); }); it("should return the separator used in US locale", () => { const result = (0, import_utils.getSeparator)("en-US"); expect(result).toBe("/"); }); }); describe("getFormat", () => { it("should return the date format for French locale", () => { const result = (0, import_utils.getFormat)("fr"); expect(result).toBe("dd-mm-yyyy"); }); it("should return the date format for US locale", () => { const result = (0, import_utils.getFormat)("en-US"); expect(result).toBe("mm-dd-yyyy"); }); }); describe("getOrderWithFormat", () => { it("should return the correct order for French locale", () => { const format = "yyyy-mm-dd"; const result = (0, import_utils.getOrderWithFormat)("fr", format); expect(result).toEqual(["dd", "mm", "yyyy"]); }); it("should return the correct order for US locale", () => { const format = "yyyy-mm-dd"; const result = (0, import_utils.getOrderWithFormat)("en-US", format); expect(result).toEqual(["mm", "dd", "yyyy"]); }); it("should handle different formats correctly", () => { const format = "yyyy-mm-dd"; const result = (0, import_utils.getOrderWithFormat)("en-US", format); expect(result).toEqual(["mm", "dd", "yyyy"]); }); it("should return an empty array for an unknown format", () => { const format = "abcd"; const result = (0, import_utils.getOrderWithFormat)("en-US", format); expect(result).toEqual([]); }); }); }); //# sourceMappingURL=utils.spec.js.map