From 0fff918a3e44a8ed45f4d66e023d1283dcc2f603 Mon Sep 17 00:00:00 2001 From: Christos Date: Fri, 17 Jan 2025 12:40:06 +0200 Subject: [PATCH] add some compact tests --- packages/i18n-calypso/test/index.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/packages/i18n-calypso/test/index.js b/packages/i18n-calypso/test/index.js index 51c7756dc7d29..ab33fc4945ad1 100644 --- a/packages/i18n-calypso/test/index.js +++ b/packages/i18n-calypso/test/index.js @@ -281,6 +281,27 @@ describe( 'I18n', function () { ).toBe( '2.500,330' ); } ); } ); + + describe( 'compact notation', function () { + describe( 'ar', () => { + beforeEach( function () { + i18n.setLocale( { + '': { + localeVariant: undefined, + localeSlug: 'ar', + }, + } ); + } ); + test( 'defaults to latin notation and localised unit', () => { + expect( numberFormat( 1234, { notation: 'compact', decimals: 1 } ) ).toEqual( '1.2 ألف' ); + } ); + test( 'non-latin/original notation and localised unit', () => { + expect( numberFormat( 1234, { notation: 'compact', decimals: 1 }, false ) ).toEqual( + '١٫٢ ألف' + ); + } ); + } ); + } ); } ); describe( 'hashed locale data', function () {