-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjest.setup.js
34 lines (26 loc) · 1009 Bytes
/
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
import 'react-native-gesture-handler/jestSetup';
import mockAsyncStorage from '@react-native-community/async-storage/jest/async-storage-mock';
jest.useFakeTimers();
jest.mock('@react-native-community/async-storage', () => mockAsyncStorage);
jest.mock('react-native-reanimated', () => {
const Reanimated = require('react-native-reanimated/mock');
// The mock for call immediately calls the callback which is incorrect
// So we override it with a no-op
Reanimated.default.call = () => {};
return Reanimated;
});
jest.mock('react-redux', () => {
const ActualReactRedux = jest.requireActual('react-redux');
const {store} = require('./src/store/StoreProvider');
return {
...ActualReactRedux,
useSelector: jest.fn().mockImplementation(() => {
return store;
}),
};
});
jest.mock('react-native/Libraries/EventEmitter/NativeEventEmitter');
jest.mock('react-native-permissions', () =>
require('react-native-permissions/mock'),
);
global.__reanimatedWorkletInit = jest.fn();