1
0
mirror of https://github.com/pavlobu/deskreen.git synced 2025-05-28 13:20:11 -07:00
deskreen/app/configs/i18next.config.client.spec.ts
2021-02-13 04:04:59 +08:00

48 lines
1.4 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('Русский', 'ru');
expectedMap.set('Українська', 'ua');
expectedMap.set('简体中文', 'zh_CN');
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('ru', 'Русский');
expectedMap.set('ua', 'Українська');
expectedMap.set('zh_CN', '简体中文');
const res = getLangISOKeyToLangFullNameMap();
expect(res).toEqual(expectedMap);
});
});
});