(core) Fix number parsing/formatting tests after updates to node version and locales

Summary:
The en-ZA locale was recently updated: https://github.com/nodejs/node/issues/48120

This caused test failures which I was happy about, until I saw af-ZA is still using the old separators.

Test Plan: Tests failed locally when using the latest node 18, then passed after this change.

Reviewers: jarek

Reviewed By: jarek

Differential Revision: https://phab.getgrist.com/D4079
pull/699/head
Alex Hall 7 months ago
parent f32563e8fb
commit 7f091cf057

@ -153,10 +153,10 @@ describe("NumberParse", function() {
check(" 123 456 789,123", 123456789.123); // normal space
check(" 123 456 789,123", 123456789.123); // NBSP
formatter = Intl.NumberFormat("en-ZA", {useGrouping: true});
formatter = Intl.NumberFormat("af-ZA", {useGrouping: true});
assert.equal(formatter.format(123456789.123), '123 456 789,123');
parser = new NumberParse("en-ZA", "ZAR");
parser = new NumberParse("af-ZA", "ZAR");
assert.equal(parser.digitGroupSeparator, " ");
assert.equal(parser.digitGroupSeparatorCurrency, " ");

@ -115,7 +115,7 @@ describe("ValueFormatter", function() {
assert.equal(fmt({numMode: 'currency'}, 0.1234567, {locale: 'fr-BE'}), '0,12 €');
assert.equal(fmt({numMode: 'currency', maxDecimals: 0}, 12.34567, {locale: 'en-GB'}), '£12.35');
assert.equal(fmt({numMode: 'currency', decimals: 0, maxDecimals: 0}, 12.34567, {locale: 'en-IE'}), '€12');
assert.equal(fmt({numMode: 'currency'}, 1.015e-8, {locale: 'en-ZA'}), 'R 0,00');
assert.equal(fmt({numMode: 'currency'}, 1.015e-8, {locale: 'af-ZA'}), 'R 0,00');
assert.equal(fmt({numMode: 'currency', maxDecimals: 10}, 1.015e-8, {locale: 'en-CA'}), '$0.0000000102');
assert.equal(fmt({numMode: 'currency'}, -1.015e-8, {locale: 'nl-BE'}), '€ -0,00');
@ -133,7 +133,7 @@ describe("ValueFormatter", function() {
assert.equal(
fmt({numMode: 'currency', decimals: 0, maxDecimals: 0}, 12.34567, {locale: 'en-IE', currency: 'SGD'}),
'$12');
assert.equal(fmt({numMode: 'currency'}, 1.015e-8, {locale: 'en-ZA', currency: 'HKD'}), '$0,00');
assert.equal(fmt({numMode: 'currency'}, 1.015e-8, {locale: 'af-ZA', currency: 'HKD'}), '$0,00');
assert.equal(
fmt({numMode: 'currency', maxDecimals: 10}, 1.015e-8, {locale: 'en-CA', currency: 'RUB'}),
'₽0.0000000102');

Loading…
Cancel
Save