-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathjest.setup.js
36 lines (31 loc) · 966 Bytes
/
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
import 'react-native-gesture-handler/jestSetup';
jest.runAllTimers();
jest.mock('react-native/Libraries/Animated/NativeAnimatedHelper');
jest.mock('react-native-vector-icons/MaterialIcons', () => 'Icon');
jest.mock('react-native-reanimated', () => {
// eslint-disable-next-line @typescript-eslint/no-var-requires
const Reanimated = require('react-native-reanimated/mock');
// The mock for `call` immediately calls the callback which is incorrect
// So we override it with a no-op
Reanimated.default.call = () => {};
return Reanimated;
});
jest.mock('react-i18next', () => ({
useTranslation: () => ({
t: (key: any) => key,
i18n: {
changeLanguage: () => new Promise(() => {}),
},
}),
}));
jest.mock('services/database', () => ({
getDatabase: () => ({
collections: {
get: jest.fn(() => ({
query: jest.fn(() => ({
fetch: jest.fn(() => Promise.resolve(true)),
})),
})),
},
}),
}));