skolplattformen-backup/apps/skolplattformen-sthlm/utils/__tests__/translation.test.ts

23 lines
634 B
TypeScript
Raw Normal View History

2021-04-16 13:04:25 +00:00
import i18n from 'i18n-js'
import { translate, translations } from '../translation'
describe('translation in swedish', () => {
beforeAll(() => {
2021-10-06 20:47:50 +00:00
i18n.translations = { sv: translations.sv }
2021-04-16 13:04:25 +00:00
i18n.locale = 'sv'
})
it('should be able to translate the word settings', () => {
expect(translate('general.settings')).toEqual('Inställningar')
2021-04-16 13:04:25 +00:00
})
})
describe('translation in english', () => {
beforeAll(() => {
2021-10-06 20:47:50 +00:00
i18n.translations = { en: translations.en }
2021-04-16 13:04:25 +00:00
i18n.locale = 'en'
})
it('should be able to translate the word settings', () => {
expect(translate('general.settings')).toEqual('Settings')
2021-04-16 13:04:25 +00:00
})
})