forked from phodal/growth
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjest.setup.js
61 lines (51 loc) · 1.14 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/* global jest fetch */
fetch = jest.fn(() => new Promise(resolve => resolve()));
jest.mock('react-native-fs', () => ({
writeFile: jest.fn(() => Promise.resolve()),
ExternalStorageDirectoryPath: 'package-path',
}));
jest.mock('react-native-splash-screen', () => ({
hide: jest.fn(),
}));
jest.mock('react-native-device-info', () => ({
getVersion: jest.fn(),
}));
jest.mock('react-native-fetch-blob', () => ({
DocumentDir: () => {},
polyfill: () => {},
config() {
return this;
},
fetch() {
return this;
},
progress() {
return this;
},
then() {
return this;
},
catch() {
return this;
},
fs: {
dirs: {},
},
}));
jest.mock('react-native-simple-toast', () => (jest.fn()));
jest.mock('ScrollView', () => jest.genMockFromModule('ScrollView'));
jest.mock('Linking', () =>
({
addEventListener: jest.fn(),
removeEventListener: jest.fn(),
openURL: jest.fn(),
canOpenURL: jest.fn(
() => new Promise(resolve => resolve(true)),
),
getInitialURL: jest.fn(),
}),
);
jest.mock('WebView', () => 'WebView');
jest.mock('react-native-zip-archive', () => ({
unzip: jest.fn(),
}));