forked from Path-Check/safeplaces-dct-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jestSetupFile.js
55 lines (51 loc) · 1.66 KB
/
jestSetupFile.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
import mockAsyncStorage from '@react-native-community/async-storage/jest/async-storage-mock';
import { NativeModules } from 'react-native';
// Device locale mocks
NativeModules.SettingsManager = NativeModules.SettingsManager || {
settings: { AppleLocale: 'en_US' },
I18nManager: { localeIdentifier: 'en_US' },
};
// Silence YellowBox useNativeDriver warning
jest.mock('react-native/Libraries/Animated/src/NativeAnimatedHelper');
jest.mock('@react-native-community/async-storage', () => mockAsyncStorage);
jest.mock(
'@react-native-community/push-notification-ios',
() => 'push-notification-ios',
);
jest.mock('react-native-share', () => 'Share');
jest.mock('rn-fetch-blob', () => 'Blob');
jest.mock('react-native-background-timer', () => 'BackgroundTimer');
jest.mock('react-native-popup-menu', () => ({
Menu: 'Menu',
MenuProvider: 'MenuProvider',
MenuOptions: 'MenuOptions',
MenuOption: 'MenuOption',
MenuTrigger: 'MenuTrigger',
}));
jest.mock('@react-navigation/native', () => {
return {
createAppContainer: jest
.fn()
.mockReturnValue(function NavigationContainer(props) {
return null;
}),
createDrawerNavigator: jest.fn(),
createMaterialTopTabNavigator: jest.fn(),
createStackNavigator: jest.fn(),
StackActions: {
push: jest
.fn()
.mockImplementation(x => ({ ...x, type: 'Navigation/PUSH' })),
replace: jest
.fn()
.mockImplementation(x => ({ ...x, type: 'Navigation/REPLACE' })),
},
NavigationActions: {
navigate: jest.fn().mockImplementation(x => x),
},
useNavigation: () => {
return { navigate: jest.fn() };
},
useFocusEffect: jest.fn(),
};
});