-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest-setup.js
28 lines (26 loc) · 1013 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
import { registerNativeHandlers } from './src/native';
// eslint-disable-next-line no-underscore-dangle
const _consoleE = console.error;
console.error = (e) => {
// For some reason following error gets rased from waitFor function.
// Source of the error is in react-test-renderer, although cause of the
// issue is unknown. Until we figure out the proper way to fix this issue,
// following hack should work. We just suppress this particular error.
// It should be safe since the error is only raised in dev environment
// https://github.com/facebook/react/blob/b683c07ccce340b9d687683d5dd7347a4c866787/packages/react-dom/src/test-utils/ReactTestUtilsAct.js#L121
if (e.indexOf('You called act(async () => ...) without await') === -1) {
_consoleE(e);
}
};
console.warn = () => {};
registerNativeHandlers({
NetInfo: {
addEventListener: () => {},
fetch: () =>
new Promise((resolve) => {
resolve();
}),
},
pickDocument: () => null,
pickImage: () => null,
});