-
Notifications
You must be signed in to change notification settings - Fork 2
/
setup.js
47 lines (41 loc) · 1.2 KB
/
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
// Libraries
const MockAsyncStorage = require('mock-async-storage').default;
require('jest-plugins')([
'jest-plugins-react',
'jest-plugins-recommended',
]);
// Hack for react-art referencing the document object.
global.document = {
createElement: () => null,
};
// Need to mock react-native. react-native-mock doesn't work with 0.47+.
// Specifying `virtual: true` will mock out this module only if it exists.
jest.mock('react-native', () => ({
// TODO(mark): Proper component mocks are much needed and all snapshots
// will need to be updated once this mock is complete.
// Modules
Animated: {},
AsyncStorage: new MockAsyncStorage(),
Clipboard: {},
Geolocation: {},
Linking: {},
NativeModules: {},
Platform: {},
StyleSheet: {},
// Components
Image: () => null,
Modal: () => null,
Switch: () => null,
Text: () => null,
TextInput: () => null,
TouchableHighlight: () => null,
TouchableOpacity: () => null,
TouchableWithoutFeedback: () => null,
View: () => null,
}), {virtual: true});
// Mock out react-native-svg since we don't have the native components.
jest.mock('react-native-svg', () => ({
Circle: () => null,
Line: () => null,
Rect: () => null,
}), {virtual: true});