diff --git a/__tests__/i18n.test.js b/__tests__/i18n.test.js new file mode 100644 index 0000000..bff9808 --- /dev/null +++ b/__tests__/i18n.test.js @@ -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); + } + }); +}); diff --git a/i18n.js b/i18n.js index a0e7b42..b6b3054 100644 --- a/i18n.js +++ b/i18n.js @@ -37,7 +37,7 @@ import ta from './langs/ta.json'; import zh_Hans from './langs/zh_Hans.json'; import zh_Hant from './langs/zh_Hant.json'; -const resources = { +export const resources = { en: { translation: en }, ar: { translation: ar }, bg: { translation: bg }, @@ -82,3 +82,6 @@ i18next }, resources }); + +// Export i18next instance for use in tests +export default i18next;