File size: 1,112 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
26
27
28
29
30
31
import { IMMEDIATE_LOGIN_SAVE_INFO } from 'calypso/state/action-types';
import reducer from '../reducer';

describe( 'immediate-login/reducer', () => {
	describe( 'reducer', () => {
		test( 'should return correctly updated state [1]', () => {
			const updatedState = reducer( null, { type: IMMEDIATE_LOGIN_SAVE_INFO } );
			expect( updatedState.attempt ).toEqual( true );
			expect( updatedState.success ).toEqual( false );
			expect( updatedState.reason ).toEqual( null );
			expect( updatedState.email ).toEqual( null );
			expect( updatedState.locale ).toEqual( null );
		} );

		test( 'should return correctly updated state [2]', () => {
			const updatedState = reducer( null, {
				type: IMMEDIATE_LOGIN_SAVE_INFO,
				success: 1,
				reason: 'test reason',
				email: 'test@example.com',
				locale: 'fr',
			} );
			expect( updatedState.attempt ).toEqual( true );
			expect( updatedState.success ).toEqual( true );
			expect( updatedState.reason ).toEqual( 'test reason' );
			expect( updatedState.email ).toEqual( 'test@example.com' );
			expect( updatedState.locale ).toEqual( 'fr' );
		} );
	} );
} );