File size: 1,294 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
37
38
39
import {
	activePromotionsReceiveAction,
	activePromotionsRequestSuccessAction,
	activePromotionsRequestFailureAction,
	requestActivePromotions,
} from '../actions';
import {
	ACTION_ACTIVE_PROMOTIONS_RECEIVE,
	ACTION_ACTIVE_PROMOTIONS_REQUEST,
	ACTION_ACTIVE_PROMOTIONS_REQUEST_SUCCESS,
	ACTION_ACTIVE_PROMOTIONS_REQUEST_FAILURE,
	WPCOM_RESPONSE as wpcomResponse,
	ERROR_MESSAGE_RESPONSE as errorResponse,
} from './fixture';

describe( 'actions', () => {
	describe( 'creators functions', () => {
		test( '#activePromotionsReceiveAction()', () => {
			const activePromotions = wpcomResponse;
			const action = activePromotionsReceiveAction( activePromotions );
			expect( action ).toEqual( ACTION_ACTIVE_PROMOTIONS_RECEIVE );
		} );

		test( '#activePromotionsRequestSuccessAction()', () => {
			const action = activePromotionsRequestSuccessAction();
			expect( action ).toEqual( ACTION_ACTIVE_PROMOTIONS_REQUEST_SUCCESS );
		} );

		test( '#activePromotionsRequestFailureAction()', () => {
			const action = activePromotionsRequestFailureAction( errorResponse );
			expect( action ).toEqual( ACTION_ACTIVE_PROMOTIONS_REQUEST_FAILURE );
		} );

		test( '#requestActivePromotions()', () => {
			expect( requestActivePromotions() ).toEqual( ACTION_ACTIVE_PROMOTIONS_REQUEST );
		} );
	} );
} );