i18n: Add test to check languages match a canonical locale (#93105)

add test to check languages match a canonical locale
This commit is contained in:
Ashley Harrison 2024-09-09 14:25:49 +01:00 committed by GitHub
parent 2585c58dd4
commit 58907a8464
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -25,6 +25,13 @@ describe('internationalization constants', () => {
expect(DEFAULT_LANGUAGE).toBe(ENGLISH_US);
});
it('should match a canonical locale definition', () => {
for (const lang of LANGUAGES) {
const resolved = Intl.getCanonicalLocales(lang.code);
expect(lang.code).toEqual(resolved[0]);
}
});
it('should not have duplicate languages codes', () => {
const uniqLocales = uniqBy(LANGUAGES, (v) => v.code);
expect(LANGUAGES).toHaveLength(uniqLocales.length);