Add test for i18n

This commit is contained in:
Bill Thornton 2021-02-23 15:44:41 -05:00
parent 3f1319bf2c
commit 672738f60a
2 changed files with 18 additions and 1 deletions

14
__tests__/i18n.test.js Normal file
View File

@ -0,0 +1,14 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
import i18next, { resources } from '../i18n';
describe('i18n', () => {
it('should initialize i18next', () => {
for (const lng of Object.keys(resources)) {
expect(i18next.hasResourceBundle(lng, 'translation')).toBe(true);
}
});
});

View File

@ -37,7 +37,7 @@ import ta from './langs/ta.json';
import zh_Hans from './langs/zh_Hans.json'; import zh_Hans from './langs/zh_Hans.json';
import zh_Hant from './langs/zh_Hant.json'; import zh_Hant from './langs/zh_Hant.json';
const resources = { export const resources = {
en: { translation: en }, en: { translation: en },
ar: { translation: ar }, ar: { translation: ar },
bg: { translation: bg }, bg: { translation: bg },
@ -82,3 +82,6 @@ i18next
}, },
resources resources
}); });
// Export i18next instance for use in tests
export default i18next;