File size: 361 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import config from '@automattic/calypso-config';

export const setFeatureFlag = ( feature, val ) => {
	const c = config;
	let spy;

	beforeAll( () => {
		spy = jest
			.spyOn( config, 'isEnabled' )
			.mockImplementation( ( feat ) => ( feat === feature ? val : c.isEnabled( feat ) ) );
	} );

	afterAll( () => {
		spy.mockReset();
		spy.mockRestore();
	} );
};