-
Notifications
You must be signed in to change notification settings - Fork 1
/
jest.setup.ts
35 lines (26 loc) · 1005 Bytes
/
jest.setup.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
import { cleanup } from '@testing-library/react-native';
import '@testing-library/jest-dom';
import 'react-native-gesture-handler/jestSetup';
import mockAsyncStorage from '@react-native-async-storage/async-storage/jest/async-storage-mock';
jest.mock('@react-native-async-storage/async-storage', () => mockAsyncStorage);
declare const global: { __reanimatedWorkletInit: ReturnType<typeof jest.fn> };
global.__reanimatedWorkletInit = jest.fn();
afterEach(cleanup);
jest.mock('react-native-reanimated', () => {
return {
...jest.requireActual('react-native-reanimated/mock'),
};
});
jest.mock('@react-navigation/core', () => ({
...jest.requireActual('@react-navigation/core'),
useNavigation: () => jest.fn(),
useIsFocused: jest.fn().mockReturnValue(false),
}));
// Mock redux-persist
jest.mock('redux-persist', () => {
const real = jest.requireActual('redux-persist');
return {
...real,
persistReducer: jest.fn().mockImplementation((config, reducers) => reducers),
};
});