File size: 782 Bytes
1e92f2d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | import { LOCALE_SET } from 'calypso/state/action-types';
import reducer from '../reducer';
describe( 'reducer', () => {
test( 'returns default state with undefined state and empty action', () => {
expect( reducer( undefined, {} ) ).toEqual( { localeSlug: 'en', localeVariant: null } );
} );
test( 'returns previous state with empty action', () => {
const state = { localeSlug: 'de', localeVariant: 'de_formal' };
expect( reducer( state, {} ) ).toBe( state );
} );
test( 'returns new state with valid slug', () => {
const state = { localeSlug: 'en', localeVariant: 'en' };
const action = { type: LOCALE_SET, localeSlug: 'de', localeVariant: 'de_formal' };
expect( reducer( state, action ) ).toEqual( { localeSlug: 'de', localeVariant: 'de_formal' } );
} );
} );
|