-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest.setup.js
38 lines (30 loc) · 1005 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
35
36
37
import { NativeModules } from "react-native";
import mockAsyncStorage from "@react-native-async-storage/async-storage/jest/async-storage-mock";
global.fetch = require( "jest-fetch-mock" );
NativeModules.RNCNetInfo = {
addListener: jest.fn(),
removeListeners: jest.fn()
};
jest.mock( "@react-navigation/native", () => ( {
...jest.requireActual( "@react-navigation/native" ),
useNavigation: jest.fn( () => ( {
addListener: jest.fn(),
navigate: jest.fn()
} ) ),
useFocusEffect: jest.fn()
} ) );
jest.mock( "@react-native-async-storage/async-storage", () => mockAsyncStorage );
jest.mock( "react-native-fs", () => ( {
addEventListener: jest.fn(),
removeEventListener: jest.fn()
} ) );
jest.mock( "react-native-device-info", () => ( {
getVersion: jest.fn(),
getDeviceType: jest.fn(),
getBuildNumber: jest.fn(),
getSystemName: jest.fn(),
getSystemVersion: jest.fn()
} ) );
jest.mock( "react-native-geolocation-service", () => ( {
getCurrentPosition: jest.fn()
} ) );