mirror of
https://github.com/SomboChea/ui
synced 2026-01-19 17:46:12 +07:00
feat(i18n): added i18next for user interface translations (#432)
This commit is contained in:
committed by
GitHub
parent
8d4b3cee7e
commit
7428384b55
@@ -16,6 +16,22 @@ jest.mock('./api', () => ({
|
||||
request: require('../../jest/unit/components/__mocks__/api').default.request,
|
||||
}));
|
||||
|
||||
jest.mock('i18next', () => {
|
||||
const translationEN = require('../../i18n/translations/en-US.json');
|
||||
return {
|
||||
t: (key: string) => {
|
||||
const splittedKey = key.split('.');
|
||||
let result = translationEN;
|
||||
|
||||
for (const element of splittedKey) {
|
||||
result = result[element];
|
||||
}
|
||||
|
||||
return result;
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
describe('isTokenExpire', (): void => {
|
||||
test('isTokenExpire - null is not a valid payload', (): void => {
|
||||
expect(isTokenExpire(null)).toBeTruthy();
|
||||
|
||||
Reference in New Issue
Block a user