Files
2025-08-06 13:49:11 +08:00

18 lines
606 B
JavaScript

/* global describe: true, test:true, expect:true */
import { locale } from '~/reducers/locale';
import { CHANGE_LOCALE } from '~/store/actionTypes';
describe('locale reducer', () => {
test('CASE 1: should return initial state', () => {
const expectedState = { locale: 'en' };
expect(locale(undefined, { type: 'Default' }))
.toEqual(expectedState);
});
test('CASE 2: should return correct state when action is `CHANGE_LOCALE`', () => {
const expectedState = { locale: 'de' };
expect(locale(undefined, { type: CHANGE_LOCALE, payload: { locale: 'de' } }))
.toEqual(expectedState);
});
});