forked from monicahq/old_mobile_app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setupJest.ts
41 lines (32 loc) · 915 Bytes
/
setupJest.ts
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
(global as any).isJestRunning = true;
const mockRnCodePush = () => Component => Component;
Object.assign(mockRnCodePush, {
CheckFrequency: 0,
});
jest.mock('react-native-code-push', () => mockRnCodePush);
jest.mock('react-native-splash-screen', () => {
return {
hide: jest.fn(),
show: jest.fn(),
};
});
jest.mock('react-native-device-info', () => {
return {
getDeviceLocale: () => 'en',
getModel: () => 'iPhone SE',
};
});
jest.mock('./package.json', () => ({
version: '1.0.0',
}));
// Setup react 16 adapter for enzyme
import Enzyme from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
// @ts-ignore
Enzyme.configure({adapter: new Adapter()});
// Mock TouchableNativeFeedback
import {TouchableNativeFeedback} from 'react-native';
TouchableNativeFeedback.SelectableBackground = jest.fn();
// Feb 14, 2017
Date.now = jest.fn(() => 1487076708000);
Math.random = () => 1;