-
Notifications
You must be signed in to change notification settings - Fork 10
/
setupJest.js
70 lines (60 loc) · 1.54 KB
/
setupJest.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
const { Response, Headers, Request } = require('whatwg-fetch');
global.Response = Response;
global.Headers = Headers;
global.Request = Request;
global.console = {
log: () => {},
warn: () => {},
};
global.fetch = require('jest-fetch-mock');
jest.mock('react-native-fetch-blob', () => {
return {
fs: {
dirs: {
MainBundleDir: () => {},
CacheDir: () => {},
DocumentDir: () => {},
},
},
DocumentDir: () => {},
fetch: () => {},
base64: () => {},
android: () => {},
ios: () => {},
config: () => {},
session: () => {},
wrap: () => {},
polyfill: () => {},
JSONStream: () => {}
}
});
jest.mock('urbanairship-react-native', () => jest.fn());
jest.mock('secp256k1', () => jest.fn());
jest.mock('bitcore-mnemonic', () => jest.fn());
jest.mock('react-native-vector-icons/Ionicons', () => ({ ToolbarAndroid: 'ToolbarAndroid' }));
jest.mock('Platform', () => {
const Platform = require.requireActual('Platform');
Platform.OS = 'android';
return Platform;
});
jest.mock('react-native-vector-icons', () => {
const ActualTabBarIOS = require.requireActual('TabBarIOS');
const React = require('react');
return {
createIconSet: () => {
const Icon = class extends React.Component {
render() {
return jest.fn();
}
}
Icon.TabBarItem = ActualTabBarIOS.Item;
return Icon;
},
createIconSetFromFontello: () => {
return {
TabBarItem: ActualTabBarIOS.Item
}
},
createIconSetFromIcoMoon: jest.fn(),
}
});