1
0
mirror of https://github.com/pavlobu/deskreen.git synced 2025-05-28 05:10:09 -07:00
deskreen/app/configs/i18next.config.client.spec.ts
Pavlo Buidenkov 10fda97870 fix tests
2021-03-03 17:54:48 +02:00

54 lines
1.6 KiB
TypeScript

/* eslint-disable @typescript-eslint/ban-ts-comment */
import {
getLangFullNameToLangISOKeyMap,
getLangISOKeyToLangFullNameMap,
} from './i18next.config.client';
jest.useFakeTimers();
describe('i18next.config.client tests', () => {
beforeEach(() => {});
afterEach(() => {
jest.clearAllMocks();
jest.restoreAllMocks();
});
describe('when getLangFullNameToLangISOKeyMap called', () => {
it('should return proper key map', () => {
// TODO: add more languages here manually when adding new languages in app!
const expectedMap = new Map();
expectedMap.set('English', 'en');
expectedMap.set('Español', 'es');
expectedMap.set('Русский', 'ru');
expectedMap.set('Українська', 'ua');
expectedMap.set('简体中文', 'zh_CN');
expectedMap.set('繁體中文', 'zh_TW');
expectedMap.set('Dansk', 'da');
const res = getLangFullNameToLangISOKeyMap();
expect(res).toEqual(expectedMap);
});
});
describe('when getLangISOKeyToLangFullNameMap called', () => {
it('should return proper key map', () => {
// TODO: add more languages here manually when adding new languages in app!
const expectedMap = new Map();
expectedMap.set('en', 'English');
expectedMap.set('es', 'Español');
expectedMap.set('ru', 'Русский');
expectedMap.set('ua', 'Українська');
expectedMap.set('zh_CN', '简体中文');
expectedMap.set('zh_TW', '繁體中文');
expectedMap.set('da', 'Dansk');
const res = getLangISOKeyToLangFullNameMap();
expect(res).toEqual(expectedMap);
});
});
});