File size: 973 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
32
33
34
35
36
import { CONCIERGE_INITIAL_REQUEST, CONCIERGE_INITIAL_UPDATE } from 'calypso/state/action-types';
import { isUserBlocked } from '../reducer';

describe( 'concierge/isUserBlocked/reducer', () => {
	const mockAppointmentDetails = {
		isUserBlocked: true,
	};

	const requestAction = {
		type: CONCIERGE_INITIAL_REQUEST,
	};

	const updateAction = {
		type: CONCIERGE_INITIAL_UPDATE,
		initial: mockAppointmentDetails,
	};

	describe( 'isUserBlocked', () => {
		test( 'should default to null.', () => {
			expect( isUserBlocked( undefined, {} ) ).toBeNull();
		} );

		test( 'should be null on receiving the request action.', () => {
			const state = mockAppointmentDetails;
			expect( isUserBlocked( state, requestAction ) ).toBeNull();
		} );

		test( 'should be the user blocked status on receiving the update action.', () => {
			const state = [];
			expect( isUserBlocked( state, updateAction ) ).toEqual(
				mockAppointmentDetails.isUserBlocked
			);
		} );
	} );
} );