-
Notifications
You must be signed in to change notification settings - Fork 2.7k
/
jest-setup.js
40 lines (34 loc) · 1.01 KB
/
jest-setup.js
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
const RESET_MODULE_EXCEPTIONS = ['react', 'react-redux'];
const shonoActualRegistryCache = {};
RESET_MODULE_EXCEPTIONS.forEach((moduleName) => {
jest.doMock(
moduleName,
() => {
if (!shonoActualRegistryCache[moduleName]) {
shonoActualRegistryCache[moduleName] = jest.requireActual(moduleName);
}
return shonoActualRegistryCache[moduleName];
},
{ virtual: true }
);
});
const { mockDetox } = require('detox-testing-library-rnn-adapter');
jest.mock('react-native-gesture-handler', () => {
return {
gestureHandlerRootHOC: jest.fn(),
};
});
mockDetox(() => require('./playground/index'));
beforeEach(() => {
const { mockNativeComponents } = require('react-native-navigation/Mock');
mockNativeComponents();
mockUILib();
});
setImmediate = (callback) => callback();
const mockUILib = () => {
const NativeModules = require('react-native').NativeModules;
NativeModules.KeyboardTrackingViewTempManager = {};
NativeModules.StatusBarManager = {
getHeight: () => 40,
};
};