Repository navigation
Expand file tree
/
Copy pathjest.setup.js
More file actions
80 lines (72 loc) · 2.14 KB
/
Copy pathjest.setup.js
File metadata and controls
80 lines (72 loc) · 2.14 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
// Jest setup — native module stubs for Expo / RN tests.
jest.mock('expo-constants', () => ({
__esModule: true,
default: {
expoConfig: {
version: '1.0.0',
android: {package: 'com.astrax.radixel'},
ios: {bundleIdentifier: 'com.astrax.radixel'},
},
nativeAppVersion: '1.0.0',
nativeBuildVersion: '1',
},
}));
jest.mock('expo-splash-screen', () => ({
preventAutoHideAsync: jest.fn().mockResolvedValue(undefined),
hideAsync: jest.fn().mockResolvedValue(undefined),
}));
jest.mock('react-native-safe-area-context', () => ({
SafeAreaProvider: ({children}) => children,
SafeAreaView: ({children}) => children,
useSafeAreaInsets: jest
.fn()
.mockReturnValue({top: 0, bottom: 0, left: 0, right: 0}),
useSafeAreaFrame: jest
.fn()
.mockReturnValue({x: 0, y: 0, width: 390, height: 844}),
}));
jest.mock('react-native-pager-view', () => {
const React = require('react');
const {View} = require('react-native');
return {
__esModule: true,
default: React.forwardRef(({children, ...props}, ref) =>
React.createElement(View, {...props, ref}, children),
),
};
});
jest.mock('expo-clipboard', () => ({
setStringAsync: jest.fn().mockResolvedValue(undefined),
}));
jest.mock('@react-native-async-storage/async-storage', () => ({
__esModule: true,
default: {
getItem: jest.fn().mockResolvedValue(null),
setItem: jest.fn().mockResolvedValue(undefined),
removeItem: jest.fn().mockResolvedValue(undefined),
},
}));
jest.mock('@shopify/flash-list', () => {
const React = require('react');
const {FlatList} = require('react-native');
return {FlashList: FlatList};
});
jest.mock('expo-updates', () => {
let isEnabled = true;
return {
get isEnabled() {
return isEnabled;
},
set isEnabled(value) {
isEnabled = Boolean(value);
},
isEmbeddedLaunch: true,
updateId: null,
channel: null,
runtimeVersion: '1.0.0',
createdAt: null,
checkForUpdateAsync: jest.fn().mockResolvedValue({isAvailable: false}),
fetchUpdateAsync: jest.fn().mockResolvedValue({isNew: false}),
reloadAsync: jest.fn().mockResolvedValue(undefined),
};
});