-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjest.setup.js
More file actions
34 lines (30 loc) · 1.09 KB
/
Copy pathjest.setup.js
File metadata and controls
34 lines (30 loc) · 1.09 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
global.IS_REACT_ACT_ENVIRONMENT = true;
const OriginalAggregateError = globalThis.AggregateError;
globalThis.AggregateError = function (errors, message) {
for (const err of errors) {
console.error('AggregateError inner:', err);
}
return new OriginalAggregateError(errors, message);
};
jest.mock('@react-native-async-storage/async-storage', () =>
require('@react-native-async-storage/async-storage/jest/async-storage-mock'),
);
jest.mock('react-native-background-actions', () => ({
start: jest.fn(() => Promise.resolve()),
stop: jest.fn(() => Promise.resolve()),
updateNotification: jest.fn(() => Promise.resolve()),
isRunning: jest.fn(() => false),
on: jest.fn(),
}));
jest.mock('react-native-paper', () => {
const RealModule = jest.requireActual('react-native-paper');
const React = require('react');
const { View } = require('react-native');
return {
...RealModule,
PaperProvider: ({ children }) => children,
Portal: ({ children }) => children,
Modal: ({ children, visible, ...rest }) =>
visible ? React.createElement(View, rest, children) : null,
};
});