Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
chriskmnds committed Jan 15, 2025
1 parent c7acb5f commit 4d7366a
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions packages/i18n-calypso/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,48 @@ describe( 'I18n', function () {
} );
} );

describe( 'getBrowserSafeLocale()', function () {
it( 'should return locale without variant when localeVariant is set', function () {
i18n.setLocale( {
'': {
localeVariant: 'de_AT',
localeSlug: 'de',
},
} );
expect( i18n.getBrowserSafeLocale() ).toBe( 'de' );
} );

it( 'should return locale with region code when localeVariant is set', function () {
i18n.setLocale( {
'': {
localeVariant: 'en-US',
localeSlug: 'en',
},
} );
expect( i18n.getBrowserSafeLocale() ).toBe( 'en-US' );
} );

it( 'should return localeSlug when localeVariant is not set', function () {
i18n.setLocale( {
'': {
localeVariant: undefined,
localeSlug: 'en',
},
} );
expect( i18n.getBrowserSafeLocale() ).toBe( 'en' );
} );

it( 'should return localeSlug when localeVariant is null', function () {
i18n.setLocale( {
'': {
localeVariant: null,
localeSlug: 'fr',
},
} );
expect( i18n.getBrowserSafeLocale() ).toBe( 'fr' );
} );
} );

describe( 'numberFormat()', function () {
describe( 'default numberFormat', function () {
it( 'should truncate decimals', function () {
Expand Down

0 comments on commit 4d7366a

Please sign in to comment.