2019-04-06 15:08:29 +02:00
|
|
|
import Language, { LanguageState, MUTATION_TYPES } from '@/store/Preferences/Language'
|
2018-12-30 08:29:12 +01:00
|
|
|
import DefaultLanguage from '~/src/constants/language'
|
|
|
|
|
|
|
|
describe('Preferences/Language', () => {
|
2019-04-06 15:08:29 +02:00
|
|
|
let state: LanguageState
|
2018-12-30 08:29:12 +01:00
|
|
|
beforeEach(() => {
|
|
|
|
state = {
|
|
|
|
language: {
|
|
|
|
language: DefaultLanguage.en.key
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
describe('mutations', () => {
|
|
|
|
describe('updateLanguage', () => {
|
|
|
|
it('should be updated', () => {
|
2019-04-06 15:08:29 +02:00
|
|
|
Language.mutations![MUTATION_TYPES.UPDATE_LANGUAGE](state, {
|
2018-12-30 08:29:12 +01:00
|
|
|
language: DefaultLanguage.ja.key
|
|
|
|
})
|
|
|
|
expect(state.language.language).toEqual(DefaultLanguage.ja.key)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
describe('changeLanguage', () => {
|
|
|
|
it('should be changed', () => {
|
2019-04-06 15:08:29 +02:00
|
|
|
Language.mutations![MUTATION_TYPES.CHANGE_LANGUAGE](state, DefaultLanguage.ja.key)
|
2018-12-30 08:29:12 +01:00
|
|
|
expect(state.language.language).toEqual(DefaultLanguage.ja.key)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|