LibJS: Ensure tests using the "ar" locale use the "arab" number system

In ICU 76, the default was changed from "arab" to "latn". See:
c149724509

The whole point of these tests was to use a non-Latin numbering system.
This patch ensures that is the case to make following patches easier to
grok.
This commit is contained in:
Timothy Flynn 2025-01-18 13:27:07 -05:00 committed by Tim Flynn
commit 0763997591
Notes: github-actions[bot] 2025-01-18 22:57:49 +00:00
11 changed files with 286 additions and 179 deletions

View file

@ -19,25 +19,27 @@ describe("special values", () => {
test("NaN", () => {
expect(NaN.toLocaleString()).toBe("NaN");
expect(NaN.toLocaleString("en")).toBe("NaN");
expect(NaN.toLocaleString("ar")).toBe("ليس رقم");
expect(NaN.toLocaleString("ar-u-nu-arab")).toBe("ليس رقم");
});
test("Infinity", () => {
expect(Infinity.toLocaleString()).toBe("∞");
expect(Infinity.toLocaleString("en")).toBe("∞");
expect(Infinity.toLocaleString("ar")).toBe("∞");
expect(Infinity.toLocaleString("ar-u-nu-arab")).toBe("∞");
});
});
describe("styles", () => {
test("decimal", () => {
expect((12).toLocaleString("en")).toBe("12");
expect((12).toLocaleString("ar")).toBe("\u0661\u0662");
expect((12).toLocaleString("ar-u-nu-arab")).toBe("\u0661\u0662");
});
test("percent", () => {
expect((0.234).toLocaleString("en", { style: "percent" })).toBe("23%");
expect((0.234).toLocaleString("ar", { style: "percent" })).toBe("\u0662\u0663\u066a\u061c");
expect((0.234).toLocaleString("ar-u-nu-arab", { style: "percent" })).toBe(
"\u0662\u0663\u066a\u061c"
);
});
test("currency", () => {
@ -50,7 +52,7 @@ describe("styles", () => {
).toBe("1.23 US dollars");
expect(
(1.23).toLocaleString("ar", {
(1.23).toLocaleString("ar-u-nu-arab", {
style: "currency",
currency: "USD",
currencyDisplay: "name",
@ -68,7 +70,7 @@ describe("styles", () => {
).toBe("1.23 kilometers per hour");
expect(
(1.23).toLocaleString("ar", {
(1.23).toLocaleString("ar-u-nu-arab", {
style: "unit",
unit: "kilometer-per-hour",
unitDisplay: "long",