Skip to content

Commit

Permalink
Remove legacy node
Browse files Browse the repository at this point in the history
  • Loading branch information
vsumner committed Jun 6, 2024
1 parent 482d3f3 commit a36f597
Showing 1 changed file with 7 additions and 20 deletions.
27 changes: 7 additions & 20 deletions packages/react-i18n/src/tests/i18n.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ const getCurrencySymbolMock: jest.Mock =
require('../utilities').getCurrencySymbol;
/* eslint-enable @typescript-eslint/no-var-requires */

const isModernNode = process.version.startsWith('v18');

describe('I18n', () => {
const defaultDetails = {locale: 'en-ca'};
const defaultTranslations = [{hello: 'Hello, {name}!'}];
Expand Down Expand Up @@ -878,7 +876,6 @@ describe('I18n', () => {
});

describe('#formatCurrency() form:auto', () => {
/* eslint-disable jest/no-if */
it.each`
locale | currency | expected
${'cs-CZ'} | ${'CZK'} | ${'1 234,56 Kč CZK'}
Expand All @@ -898,8 +895,8 @@ describe('I18n', () => {
${'fr-FR'} | ${'OMR'} | ${'1 234,560 OMR'}
${'fr-FR'} | ${'USD'} | ${'1 234,56 $ USD'}
${'fr-FR'} | ${'CAD'} | ${'1 234,56 $'}
${'ar-EG'} | ${'CAD'} | ${isModernNode ? '1,234.56 $' : '$ 1,234.56'}
${'ar-EG'} | ${'USD'} | ${isModernNode ? '1,234.56 $ USD' : '$ 1,234.56 USD'}
${'ar-EG'} | ${'CAD'} | ${'1,234.56 $'}
${'ar-EG'} | ${'USD'} | ${'1,234.56 $ USD'}
${'he-IL'} | ${'USD'} | ${'1,234.56 $ USD'}
`(
'formats 1234.56 of $currency in $locale to expected $expected',
Expand All @@ -918,7 +915,6 @@ describe('I18n', () => {
});

describe('#formatCurrency() form:explicit', () => {
/* eslint-disable jest/no-if */
it.each`
locale | currency | expected
${'cs-CZ'} | ${'CZK'} | ${'1 234,56 Kč CZK'}
Expand All @@ -935,7 +931,7 @@ describe('I18n', () => {
${'fr-FR'} | ${'JPY'} | ${'1 235 ¥ JPY'}
${'fr-FR'} | ${'OMR'} | ${'1 234,560 OMR'}
${'fr-FR'} | ${'USD'} | ${'1 234,56 $ USD'}
${'ar-EG'} | ${'USD'} | ${isModernNode ? '1,234.56 $ USD' : '$ 1,234.56 USD'}
${'ar-EG'} | ${'USD'} | ${'1,234.56 $ USD'}
${'he-IL'} | ${'USD'} | ${'1,234.56 $ USD'}
`(
'formats 1234.56 of $currency in $locale to expected $expected',
Expand All @@ -954,7 +950,6 @@ describe('I18n', () => {
});

describe('#formatCurrency() form:explicit with negative amount', () => {
/* eslint-disable jest/no-if */
it.each`
locale | currency | expected
${'cs-CZ'} | ${'CZK'} | ${'-1 234,56 Kč CZK'}
Expand All @@ -971,7 +966,7 @@ describe('I18n', () => {
${'fr-FR'} | ${'JPY'} | ${'-1 235 ¥ JPY'}
${'fr-FR'} | ${'OMR'} | ${'-1 234,560 OMR'}
${'fr-FR'} | ${'USD'} | ${'-1 234,56 $ USD'}
${'ar-EG'} | ${'USD'} | ${isModernNode ? '\u200E-1,234.56 $ USD' : '\u200E-$ 1,234.56 USD'}
${'ar-EG'} | ${'USD'} | ${'\u200E-1,234.56 $ USD'}
${'he-IL'} | ${'USD'} | ${'\u200E-1,234.56 $ USD'}
`(
'formats -1234.56 of $currency in $locale to expected $expected',
Expand Down Expand Up @@ -1054,7 +1049,6 @@ describe('I18n', () => {
});

describe('#formatCurrency() form:short', () => {
/* eslint-disable jest/no-if */
it.each`
locale | currency | expected
${'cs-CZ'} | ${'CZK'} | ${'1 234,56 Kč'}
Expand All @@ -1075,7 +1069,7 @@ describe('I18n', () => {
${'sv-SE'} | ${'USD'} | ${'1 234,56 $'}
${'en-US'} | ${'SGD'} | ${'$1,234.56'}
${'fr-FR'} | ${'SGD'} | ${'1 234,56 $'}
${'ar-EG'} | ${'USD'} | ${isModernNode ? '1,234.56 $' : '$ 1,234.56'}
${'ar-EG'} | ${'USD'} | ${'1,234.56 $'}
`(
'formats 1234.56 of $currency in $locale to expected $expected',
({locale, currency, expected}) => {
Expand All @@ -1090,7 +1084,6 @@ describe('I18n', () => {
});

describe('#formatCurrency() form:short with negative amount', () => {
/* eslint-disable jest/no-if */
it.each`
locale | currency | expected
${'cs-CZ'} | ${'CZK'} | ${'-1 234,56 Kč'}
Expand All @@ -1109,7 +1102,7 @@ describe('I18n', () => {
${'sv-SE'} | ${'USD'} | ${'\u22121 234,56 $'}
${'en-US'} | ${'SGD'} | ${'-$1,234.56'}
${'fr-FR'} | ${'SGD'} | ${'-1 234,56 $'}
${'ar-EG'} | ${'USD'} | ${isModernNode ? '\u200E-1,234.56 $' : '\u200E-$ 1,234.56'}
${'ar-EG'} | ${'USD'} | ${'\u200E-1,234.56 $'}
${'he-IL'} | ${'USD'} | ${'\u200E-1,234.56 $'}
`(
'formats -1234.56 of $currency in $locale to expected $expected',
Expand Down Expand Up @@ -2197,13 +2190,7 @@ describe('I18n', () => {
['Europe/Amsterdam', 'en-CA', 'CA', 'Jun 12, 2022', '6:34 p.m.'],
['Europe/Amsterdam', 'es', 'ES', '12 jun 2022', '18:34'],
['Europe/Amsterdam', 'fr', 'FR', '12 juin 2022', '18:34'],
[
'Europe/Amsterdam',
'nl-NL',
'NL',
isModernNode ? '12 jun 2022' : '12 jun. 2022',
'18:34',
],
['Europe/Amsterdam', 'nl-NL', 'NL', '12 jun 2022', '18:34'],
['Europe/London', 'en-GB', 'GB', '12 Jun 2022', '17:34'],
];

Expand Down

0 comments on commit a36f597

Please sign in to comment.