forked from EdgeApp/edge-react-gui
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestSetup.js
More file actions
136 lines (132 loc) · 3.3 KB
/
testSetup.js
File metadata and controls
136 lines (132 loc) · 3.3 KB
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
/* eslint-disable flowtype/require-valid-file-annotation */
import dateformat from 'dateformat'
/* globals jest */
jest.mock('dateformat', () => (number, format) => dateformat(number, format, true)) // force timezone to UTC
jest.mock('react-native-device-info', () => ({
getBrand() {
return 'Apple'
},
getBuildNumber() {
return '2019010101'
},
getBundleId() {
return 'co.edgesecure.app'
},
getDeviceId() {
return 'iPhone7,2'
},
getUniqueId() {
return 'abcd1234'
},
getUserAgent() {
return Promise.resolve(
'Mozilla/5.0 (iPhone9,3; U; CPU iPhone OS 10_0_1 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) Version/10.0 Mobile/14A403 Safari/602.1'
)
},
getVersion() {
return '1.2.3'
}
}))
jest.mock('edge-login-ui-rn', () => ({
getSupportedBiometryType() {
return 'FaceID'
}
}))
jest.mock('react-native-firebase', () => ({ isMock: true }))
jest.mock('react-native-share', () => 'RNShare')
jest.mock(
'react-native-sound',
() =>
class Sound {
static setCategory() {}
play() {}
}
)
jest.mock('react-native-camera', () => ({
RNCamera: {
Constants: {
FlashMode: { torch: 'torch', off: 'off' },
Type: { back: 'back' }
}
}
}))
jest.mock('Linking', () => {
return {
addEventListener: jest.fn(),
removeEventListener: jest.fn(),
openURL: jest.fn(),
canOpenURL: jest.fn(),
getInitialURL: jest.fn()
}
})
jest.mock('react-native-safari-view', () => ({
show: () => jest.fn()
}))
jest.mock('react-native-fs', () => {
// https://github.com/itinance/react-native-fs/issues/404
return {
mkdir: jest.fn(),
moveFile: jest.fn(),
copyFile: jest.fn(),
pathForBundle: jest.fn(),
pathForGroup: jest.fn(),
getFSInfo: jest.fn(),
getAllExternalFilesDirs: jest.fn(),
unlink: jest.fn(),
exists: jest.fn(),
stopDownload: jest.fn(),
resumeDownload: jest.fn(),
isResumable: jest.fn(),
stopUpload: jest.fn(),
completeHandlerIOS: jest.fn(),
readDir: jest.fn(),
readDirAssets: jest.fn(),
existsAssets: jest.fn(),
readdir: jest.fn(),
setReadable: jest.fn(),
stat: jest.fn(),
readFile: jest.fn(),
read: jest.fn(),
readFileAssets: jest.fn(),
hash: jest.fn(),
copyFileAssets: jest.fn(),
copyFileAssetsIOS: jest.fn(),
copyAssetsVideoIOS: jest.fn(),
writeFile: jest.fn(),
appendFile: jest.fn(),
write: jest.fn(),
downloadFile: jest.fn(),
uploadFiles: jest.fn(),
touch: jest.fn(),
MainBundlePath: jest.fn(),
CachesDirectoryPath: jest.fn(),
DocumentDirectoryPath: jest.fn(),
ExternalDirectoryPath: jest.fn(),
ExternalStorageDirectoryPath: jest.fn(),
TemporaryDirectoryPath: jest.fn(),
LibraryDirectoryPath: jest.fn(),
PicturesDirectoryPath: jest.fn()
}
})
jest.mock('react-native-localize', () => {
return {
getCountry() {
return 'US'
},
getCurrencies() {
return ['USD', 'EUR'] // List can sometimes be empty!
},
getLocales() {
return [
{ countryCode: 'US', languageTag: 'en-US', languageCode: 'en', isRTL: false },
{ countryCode: 'FR', languageTag: 'fr-FR', languageCode: 'fr', isRTL: false }
]
},
getNumberFormatSettings() {
return {
decimalSeparator: '.',
groupingSeparator: ','
}
}
}
})