1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-24 10:27:10 +02:00
joplin/packages/lib/locale.test.ts
2023-05-10 12:20:03 +01:00

19 lines
502 B
TypeScript

import { closestSupportedLocale } from './locale';
describe('locale', () => {
it('should find the closest matching locale', () => {
const testCases: [string, string[], string][] = [
['fr', ['fr_FR', 'en_GB'], 'fr_FR'],
['pt-br', ['fr_FR', 'en_GB', 'pt_BR'], 'pt_BR'],
['ro', ['fr_FR', 'en_GB', 'pt_BR'], 'en_GB'],
];
for (const [input, locales, expected] of testCases) {
const actual = closestSupportedLocale(input, true, locales);
expect(actual).toBe(expected);
}
});
});