diff --git a/packages/i18nify-js/src/modules/currency/__tests__/formatNumber.test.ts b/packages/i18nify-js/src/modules/currency/__tests__/formatNumber.test.ts index e3beeee1..5ffe7a2e 100644 --- a/packages/i18nify-js/src/modules/currency/__tests__/formatNumber.test.ts +++ b/packages/i18nify-js/src/modules/currency/__tests__/formatNumber.test.ts @@ -176,7 +176,7 @@ describe('formatNumber', () => { ['BBD', 'en-BB', 'Bds$123,456.33'], ['BMD', 'en-BM', 'BD$123,456.33'], ['CVE', 'en-CV', `CVE${nbsp}123,456.33`], - ['CAD', 'en-CA', 'C$123,456.33'], + ['CAD', 'en-CA', 'CA$123,456.33'], ['KYD', 'en-KY', 'CI$123,456.33'], ['CLP', 'en-CL', `CLP${nbsp}123,456`], ['COP', 'en-CO', `COP${nbsp}123,456.33`], @@ -194,6 +194,16 @@ describe('formatNumber', () => { ['SBD', 'en-SB', 'SI$123,456.33'], ['SRD', 'en-SR', `SRD${nbsp}123,456.33`], ['ZWL', 'en-ZW', `ZWL${nbsp}123,456.33`], + ['LSL', 'en-LS', `LSL${nbsp}123,456.33`], + ['AWG', 'en-AW', `AWG${nbsp}123,456.33`], + ['BYN', 'en', `BYN${nbsp}123,456.33`], + ['XAF', 'en-CM', `FCFA${nbsp}123,456`], + ['CNY', 'en-CN', `CN¥123,456.33`], + ['EGP', 'en-EG', `EGP${nbsp}123,456.33`], + ['FKP', 'en-FK', `FK£123,456.33`], + ['LBP', 'en-LB', `LBP${nbsp}123,456`], + ['SSP', 'en', `SSP${nbsp}123,456.33`], + ['WST', 'en-WS', `WS$123,456.33`], ]; it.each(intlMappedTestCases)( diff --git a/packages/i18nify-js/src/modules/currency/__tests__/formatNumberByParts.test.ts b/packages/i18nify-js/src/modules/currency/__tests__/formatNumberByParts.test.ts index 43ca3d29..bdbe90a2 100644 --- a/packages/i18nify-js/src/modules/currency/__tests__/formatNumberByParts.test.ts +++ b/packages/i18nify-js/src/modules/currency/__tests__/formatNumberByParts.test.ts @@ -295,6 +295,16 @@ describe('formatNumberByParts', () => { ['SBD', 'en-SB'], ['SRD', 'en-SR'], ['ZWL', 'en-ZW'], + ['LSL', 'en-LS'], + ['AWG', 'en-AW'], + ['BYN', 'en'], + ['XAF', 'en-CM'], + ['CNY', 'en-CN'], + ['EGP', 'en-EG'], + ['FKP', 'en-FK'], + ['LBP', 'en-LB'], + ['SSP', 'en'], + ['WST', 'en-WS'], ]; it.each(intlMappedTestCases)( diff --git a/packages/i18nify-js/src/modules/currency/__tests__/mocks/formatNumberToParts.ts b/packages/i18nify-js/src/modules/currency/__tests__/mocks/formatNumberToParts.ts index 7780a4e9..c62f445e 100644 --- a/packages/i18nify-js/src/modules/currency/__tests__/mocks/formatNumberToParts.ts +++ b/packages/i18nify-js/src/modules/currency/__tests__/mocks/formatNumberToParts.ts @@ -124,13 +124,13 @@ export const positiveNumberPartsIntlMap = { ], }, CAD: { - currency: 'C$', + currency: 'CA$', decimal: '.', fraction: '33', integer: '123,456', isPrefixSymbol: true, rawParts: [ - { type: 'currency', value: 'C$' }, + { type: 'currency', value: 'CA$' }, { type: 'integer', value: '123' }, { type: 'group', value: ',' }, { type: 'integer', value: '456' }, @@ -396,6 +396,155 @@ export const positiveNumberPartsIntlMap = { { type: 'fraction', value: '33' }, ], }, + LSL: { + currency: 'LSL', + decimal: '.', + fraction: '33', + integer: '123,456', + isPrefixSymbol: true, + rawParts: [ + { type: 'currency', value: 'LSL' }, + { type: 'literal', value: `${nbsp}` }, + { type: 'integer', value: '123' }, + { type: 'group', value: ',' }, + { type: 'integer', value: '456' }, + { type: 'decimal', value: '.' }, + { type: 'fraction', value: '33' }, + ], + }, + AWG: { + currency: 'AWG', + decimal: '.', + fraction: '33', + integer: '123,456', + isPrefixSymbol: true, + rawParts: [ + { type: 'currency', value: 'AWG' }, + { type: 'literal', value: `${nbsp}` }, + { type: 'integer', value: '123' }, + { type: 'group', value: ',' }, + { type: 'integer', value: '456' }, + { type: 'decimal', value: '.' }, + { type: 'fraction', value: '33' }, + ], + }, + BYN: { + currency: 'BYN', + decimal: '.', + fraction: '33', + integer: '123,456', + isPrefixSymbol: true, + rawParts: [ + { type: 'currency', value: 'BYN' }, + { type: 'literal', value: `${nbsp}` }, + { type: 'integer', value: '123' }, + { type: 'group', value: ',' }, + { type: 'integer', value: '456' }, + { type: 'decimal', value: '.' }, + { type: 'fraction', value: '33' }, + ], + }, + XAF: { + currency: 'FCFA', + integer: '123,456', + isPrefixSymbol: true, + rawParts: [ + { type: 'currency', value: 'FCFA' }, + { type: 'literal', value: `${nbsp}` }, + { type: 'integer', value: '123' }, + { type: 'group', value: ',' }, + { type: 'integer', value: '456' }, + ], + }, + CNY: { + currency: 'CN¥', + decimal: '.', + fraction: '33', + integer: '123,456', + isPrefixSymbol: true, + rawParts: [ + { type: 'currency', value: 'CN¥' }, + { type: 'integer', value: '123' }, + { type: 'group', value: ',' }, + { type: 'integer', value: '456' }, + { type: 'decimal', value: '.' }, + { type: 'fraction', value: '33' }, + ], + }, + EGP: { + currency: 'EGP', + decimal: '.', + fraction: '33', + integer: '123,456', + isPrefixSymbol: true, + rawParts: [ + { type: 'currency', value: 'EGP' }, + { type: 'literal', value: `${nbsp}` }, + { type: 'integer', value: '123' }, + { type: 'group', value: ',' }, + { type: 'integer', value: '456' }, + { type: 'decimal', value: '.' }, + { type: 'fraction', value: '33' }, + ], + }, + FKP: { + currency: 'FK£', + decimal: '.', + fraction: '33', + integer: '123,456', + isPrefixSymbol: true, + rawParts: [ + { type: 'currency', value: 'FK£' }, + { type: 'integer', value: '123' }, + { type: 'group', value: ',' }, + { type: 'integer', value: '456' }, + { type: 'decimal', value: '.' }, + { type: 'fraction', value: '33' }, + ], + }, + LBP: { + currency: 'LBP', + integer: '123,456', + isPrefixSymbol: true, + rawParts: [ + { type: 'currency', value: 'LBP' }, + { type: 'literal', value: `${nbsp}` }, + { type: 'integer', value: '123' }, + { type: 'group', value: ',' }, + { type: 'integer', value: '456' }, + ], + }, + SSP: { + currency: 'SSP', + decimal: '.', + fraction: '33', + integer: '123,456', + isPrefixSymbol: true, + rawParts: [ + { type: 'currency', value: 'SSP' }, + { type: 'literal', value: `${nbsp}` }, + { type: 'integer', value: '123' }, + { type: 'group', value: ',' }, + { type: 'integer', value: '456' }, + { type: 'decimal', value: '.' }, + { type: 'fraction', value: '33' }, + ], + }, + WST: { + currency: 'WS$', + decimal: '.', + fraction: '33', + integer: '123,456', + isPrefixSymbol: true, + rawParts: [ + { type: 'currency', value: 'WS$' }, + { type: 'integer', value: '123' }, + { type: 'group', value: ',' }, + { type: 'integer', value: '456' }, + { type: 'decimal', value: '.' }, + { type: 'fraction', value: '33' }, + ], + }, }; export const negativeNumberPartsIntlMap = { @@ -538,7 +687,7 @@ export const negativeNumberPartsIntlMap = { ], }, CAD: { - currency: 'C$', + currency: 'CA$', decimal: '.', fraction: '33', integer: '123,456', @@ -546,7 +695,7 @@ export const negativeNumberPartsIntlMap = { minusSign: '-', rawParts: [ { type: 'minusSign', value: '-' }, - { type: 'currency', value: 'C$' }, + { type: 'currency', value: 'CA$' }, { type: 'integer', value: '123' }, { type: 'group', value: ',' }, { type: 'integer', value: '456' }, @@ -846,4 +995,173 @@ export const negativeNumberPartsIntlMap = { { type: 'fraction', value: '33' }, ], }, + LSL: { + currency: 'LSL', + decimal: '.', + fraction: '33', + integer: '123,456', + isPrefixSymbol: true, + minusSign: '-', + rawParts: [ + { type: 'minusSign', value: '-' }, + { type: 'currency', value: 'LSL' }, + { type: 'literal', value: `${nbsp}` }, + { type: 'integer', value: '123' }, + { type: 'group', value: ',' }, + { type: 'integer', value: '456' }, + { type: 'decimal', value: '.' }, + { type: 'fraction', value: '33' }, + ], + }, + AWG: { + currency: 'AWG', + decimal: '.', + fraction: '33', + integer: '123,456', + isPrefixSymbol: true, + minusSign: '-', + rawParts: [ + { type: 'minusSign', value: '-' }, + { type: 'currency', value: 'AWG' }, + { type: 'literal', value: `${nbsp}` }, + { type: 'integer', value: '123' }, + { type: 'group', value: ',' }, + { type: 'integer', value: '456' }, + { type: 'decimal', value: '.' }, + { type: 'fraction', value: '33' }, + ], + }, + BYN: { + currency: 'BYN', + decimal: '.', + fraction: '33', + integer: '123,456', + isPrefixSymbol: true, + minusSign: '-', + rawParts: [ + { type: 'minusSign', value: '-' }, + { type: 'currency', value: 'BYN' }, + { type: 'literal', value: `${nbsp}` }, + { type: 'integer', value: '123' }, + { type: 'group', value: ',' }, + { type: 'integer', value: '456' }, + { type: 'decimal', value: '.' }, + { type: 'fraction', value: '33' }, + ], + }, + XAF: { + currency: 'FCFA', + integer: '123,456', + isPrefixSymbol: true, + minusSign: '-', + rawParts: [ + { type: 'minusSign', value: '-' }, + { type: 'currency', value: 'FCFA' }, + { type: 'literal', value: `${nbsp}` }, + { type: 'integer', value: '123' }, + { type: 'group', value: ',' }, + { type: 'integer', value: '456' }, + ], + }, + CNY: { + currency: 'CN¥', + decimal: '.', + fraction: '33', + integer: '123,456', + isPrefixSymbol: true, + minusSign: '-', + rawParts: [ + { type: 'minusSign', value: '-' }, + { type: 'currency', value: 'CN¥' }, + { type: 'integer', value: '123' }, + { type: 'group', value: ',' }, + { type: 'integer', value: '456' }, + { type: 'decimal', value: '.' }, + { type: 'fraction', value: '33' }, + ], + }, + EGP: { + currency: 'EGP', + decimal: '.', + fraction: '33', + integer: '123,456', + isPrefixSymbol: true, + minusSign: '-', + rawParts: [ + { type: 'minusSign', value: '-' }, + { type: 'currency', value: 'EGP' }, + { type: 'literal', value: `${nbsp}` }, + { type: 'integer', value: '123' }, + { type: 'group', value: ',' }, + { type: 'integer', value: '456' }, + { type: 'decimal', value: '.' }, + { type: 'fraction', value: '33' }, + ], + }, + FKP: { + currency: 'FK£', + decimal: '.', + fraction: '33', + integer: '123,456', + isPrefixSymbol: true, + minusSign: '-', + rawParts: [ + { type: 'minusSign', value: '-' }, + { type: 'currency', value: 'FK£' }, + { type: 'integer', value: '123' }, + { type: 'group', value: ',' }, + { type: 'integer', value: '456' }, + { type: 'decimal', value: '.' }, + { type: 'fraction', value: '33' }, + ], + }, + LBP: { + currency: 'LBP', + integer: '123,456', + isPrefixSymbol: true, + minusSign: '-', + rawParts: [ + { type: 'minusSign', value: '-' }, + { type: 'currency', value: 'LBP' }, + { type: 'literal', value: `${nbsp}` }, + { type: 'integer', value: '123' }, + { type: 'group', value: ',' }, + { type: 'integer', value: '456' }, + ], + }, + SSP: { + currency: 'SSP', + decimal: '.', + fraction: '33', + integer: '123,456', + isPrefixSymbol: true, + minusSign: '-', + rawParts: [ + { type: 'minusSign', value: '-' }, + { type: 'currency', value: 'SSP' }, + { type: 'literal', value: `${nbsp}` }, + { type: 'integer', value: '123' }, + { type: 'group', value: ',' }, + { type: 'integer', value: '456' }, + { type: 'decimal', value: '.' }, + { type: 'fraction', value: '33' }, + ], + }, + WST: { + currency: 'WS$', + decimal: '.', + fraction: '33', + integer: '123,456', + isPrefixSymbol: true, + minusSign: '-', + rawParts: [ + { type: 'minusSign', value: '-' }, + { type: 'currency', value: 'WS$' }, + { type: 'integer', value: '123' }, + { type: 'group', value: ',' }, + { type: 'integer', value: '456' }, + { type: 'decimal', value: '.' }, + { type: 'fraction', value: '33' }, + ], + }, };