-
Notifications
You must be signed in to change notification settings - Fork 6
/
jest.setup.js
46 lines (36 loc) · 1.64 KB
/
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
37
38
39
40
41
42
43
44
45
46
/* eslint-disable global-require */
import mockAsyncStorage from '@react-native-async-storage/async-storage/jest/async-storage-mock';
import mockRNCNetInfo from '@react-native-community/netinfo/jest/netinfo-mock';
import { NativeModules } from 'react-native';
import 'react-native-gesture-handler/jestSetup';
import './__mocks__/@react-native-firebase';
jest.mock('@react-native-community/netinfo', () => mockRNCNetInfo);
jest.mock('@react-native-async-storage/async-storage', () => mockAsyncStorage);
NativeModules.RNCNetInfo = {
getCurrentState: jest.fn(() => Promise.resolve()),
addListener: jest.fn(),
removeListeners: jest.fn(),
};
jest.mock('react-native-text-input-mask', () => ({
default: jest.fn(),
}));
jest.mock('react-native-reanimated', () => {
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;
});
// Silence the warning: Animated: `useNativeDriver` is not supported
// because the native animated module is missing
jest.mock('react-native/Libraries/Animated/NativeAnimatedHelper');
/*
* Mock para trocar o KASV por ScrollView durante os testes, pois o
* FormularioLogin é encapsulado pelo componente IDSaudeLoginTemplate
* https://github.com/APSL/react-native-keyboard-aware-scroll-view/issues/493
*/
jest.mock('react-native-keyboard-aware-scroll-view', () => {
const KeyboardAwareScrollView = require('react-native').ScrollView;
return { KeyboardAwareScrollView };
});
jest.mock('react-native-permissions', () => require('react-native-permissions/mock'));