From 0aee86be11924052d4bdca682890d6874843c7da Mon Sep 17 00:00:00 2001 From: Kiril Peyanski Date: Thu, 21 Dec 2023 15:41:31 +0200 Subject: [PATCH] test(currency): add case for lang/locale pair without explicit symbol --- test/numbers.test.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/test/numbers.test.js b/test/numbers.test.js index cd2a3da9..53fc1a13 100644 --- a/test/numbers.test.js +++ b/test/numbers.test.js @@ -6,7 +6,10 @@ const numbers = require("cldr-numbers-full/main/bg/numbers.json"); const currencies = require("cldr-numbers-full/main/bg/currencies.json"); const currencyData = require("cldr-core/supplemental/currencyData.json"); -load(likelySubtags, currencyData, numbers, currencies); +const localNumbers = require("cldr-numbers-full/main/de-CH/numbers.json"); +const localCurrencies = require("cldr-numbers-full/main/de-CH/currencies.json"); + +load(likelySubtags, currencyData, numbers, currencies, localNumbers, localCurrencies); function loadCustom(options) { load({ @@ -300,6 +303,10 @@ describe('standard currency formatting', () => { expect(formatNumber(10, "c", "bg-BG")).toEqual("10,00 лв."); }); + it("should apply format when passing language and territory without symbol", () => { + expect(formatNumber(10, "c", "de-CH")).toEqual("CHF 10.00"); + }); + it("should apply format when passing object", () => { expect(formatNumber(10, { style: "currency" })).toEqual("$10.00"); });