UNPKG

@crossed/ui

Version:

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

44 lines (43 loc) 1.59 kB
var import_utils = require("../utils"); describe("capFirstLetter", () => { test("should capitalize the first letter of a string", () => { expect((0, import_utils.capFirstLetter)("hello")).toBe("Hello"); }); test("should return an empty string if input is empty", () => { expect((0, import_utils.capFirstLetter)("")).toBe(""); }); }); describe("getLocalMonthNames", () => { test("should return an array of month names in the correct locale", () => { const months = (0, import_utils.getLocalMonthNames)("en-US"); expect(months).toHaveLength(12); expect(months[0]).toBe("January"); }); test("should capitalize the first letter of each month", () => { const months = (0, import_utils.getLocalMonthNames)("fr-FR"); expect( months.every((month) => month.charAt(0) === month.charAt(0).toUpperCase()) ).toBe(true); }); }); describe("generateYearRange", () => { test("should return a range of years from min to max", () => { expect((0, import_utils.generateYearRange)(2e3, 2005)).toEqual([ 2e3, 2001, 2002, 2003, 2004, 2005 ]); }); test("should return a single year if minYear and maxYear are the same", () => { expect((0, import_utils.generateYearRange)(2023, 2023)).toEqual([2023]); }); test("should throw an error if minYear is greater than maxYear", () => { expect(() => (0, import_utils.generateYearRange)(2025, 2020)).toThrow( "L'ann\xE9e minimale doit \xEAtre inf\xE9rieure ou \xE9gale \xE0 l'ann\xE9e maximale." ); }); }); //# sourceMappingURL=utils.spec.js.map