File size: 674 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import { I18N_LANGUAGE_NAMES_ADD } from 'calypso/state/action-types';
import reducer, { items } from '../reducer';

describe( 'reducer', () => {
	test( 'should include expected keys in return value', () => {
		expect( Object.keys( reducer( undefined, {} ) ) ).toEqual( [ 'items' ] );
	} );

	describe( '#items()', () => {
		test( 'should default to empty object', () => {
			const state = items( undefined, {} );
			expect( state ).toBe( null );
		} );

		test( 'should update with items', () => {
			const state = items( undefined, {
				type: I18N_LANGUAGE_NAMES_ADD,
				items: { neil: 'down' },
			} );

			expect( state ).toEqual( { neil: 'down' } );
		} );
	} );
} );