import { getSeparators } from "./localeUtility"; describe("localeUtility", () => { test("getSeparators with known locale in staticFallback", () => { const result = getSeparators("en"); expect(result.decimal).toBe("."); expect(result.thousands).toBe(","); }); test("getSeparators with locale not in staticFallback", () => { // Test locales not in staticFallback (en, es, fr, ja, ko, ru, zh are in the list) // Line 18: fallback when hasOwnProperty returns false - uses "en" fallback // The getFallback function checks if locale is in staticFallback, if not uses "en" const result = getSeparators("it"); expect(result.decimal).toBeDefined(); expect(result.thousands).toBeDefined(); }); test("getFallback uses en when locale not in staticFallback - tests line 18", () => { // Line 18: staticFallback[hasOwnProperty(...) ? locale : "en"] // When hasOwnProperty returns false, uses "en" as fallback // This branch is only hit when localeNotAvailable is true AND locale not in staticFallback // Test with valid locale not in staticFallback (it, de, nl, etc.) const result = getSeparators("de"); expect(result.decimal).toBeDefined(); expect(result.thousands).toBeDefined(); }); });