File size: 1,350 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
40
41
42
43
44
45
46
47
48
jest.mock( '@automattic/calypso-products', () => ( {
	...jest.requireActual( '@automattic/calypso-products' ),
	GROUP_WPCOM: 'GROUP_WPCOM',
	GROUP_JETPACK: 'GROUP_JETPACK',

	TERM_MONTHLY: 'TERM_MONTHLY',
	TERM_ANNUALLY: 'TERM_ANNUALLY',
	TERM_BIENNIALLY: 'TERM_BIENNIALLY',

	TYPE_FREE: 'TYPE_FREE',
	TYPE_PERSONAL: 'TYPE_PERSONAL',
	TYPE_PREMIUM: 'TYPE_PREMIUM',
	TYPE_BUSINESS: 'TYPE_BUSINESS',

	ACTIVE_PROMOTIONS_LIST: {
		jetpack_premium_monthly: {
			term: 'TERM_MONTHLY',
		},
		value_bundle: {
			term: 'TERM_ANNUALLY',
		},
		'personal-bundle-2y': {
			term: 'TERM_BIENNIALLY',
		},
	},
} ) );

import { getActivePromotions, isRequestingActivePromotions } from '../selectors';
import { ACTIVE_PROMOTIONS, getStateInstance } from './fixture';

describe( 'selectors', () => {
	describe( '#getActivePromotions()', () => {
		test( 'should return WordPress ActivePromotions array', () => {
			const state = getStateInstance();
			const activePromotions = getActivePromotions( state );
			expect( activePromotions ).toEqual( ACTIVE_PROMOTIONS );
		} );
	} );

	describe( '#isRequestingActivePromotions()', () => {
		test( 'should return requesting state of ActivePromotions', () => {
			const state = getStateInstance();
			const isRequesting = isRequestingActivePromotions( state );
			expect( isRequesting ).toEqual( false );
		} );
	} );
} );