2022-03-29 16:09:44 +00:00
|
|
|
import mockClipboard from '@react-native-clipboard/clipboard/jest/clipboard-mock.js';
|
2022-08-19 19:53:40 +00:00
|
|
|
import mockAsyncStorage from '@react-native-async-storage/async-storage/jest/async-storage-mock';
|
2022-06-10 20:33:48 +00:00
|
|
|
|
2022-08-19 19:53:40 +00:00
|
|
|
jest.mock('@react-native-async-storage/async-storage', () => mockAsyncStorage);
|
2022-03-29 16:09:44 +00:00
|
|
|
|
2022-08-19 19:53:40 +00:00
|
|
|
global.__reanimatedWorkletInit = () => {};
|
|
|
|
jest.mock('react-native-reanimated', () => require('react-native-reanimated/mock'));
|
2022-06-06 13:23:49 +00:00
|
|
|
|
2022-03-29 16:09:44 +00:00
|
|
|
jest.mock('@react-native-clipboard/clipboard', () => mockClipboard);
|
|
|
|
|
|
|
|
jest.mock('rn-fetch-blob', () => ({
|
|
|
|
fs: {
|
|
|
|
dirs: {
|
|
|
|
DocumentDir: '/data/com.rocket.chat/documents',
|
|
|
|
DownloadDir: '/data/com.rocket.chat/downloads'
|
|
|
|
},
|
|
|
|
exists: jest.fn(() => null)
|
|
|
|
},
|
|
|
|
fetch: jest.fn(() => null),
|
|
|
|
config: jest.fn(() => null)
|
|
|
|
}));
|
|
|
|
|
|
|
|
jest.mock('react-native-file-viewer', () => ({
|
|
|
|
open: jest.fn(() => null)
|
|
|
|
}));
|
|
|
|
|
2022-06-06 13:23:49 +00:00
|
|
|
jest.mock('expo-haptics', () => jest.fn(() => null));
|
|
|
|
|
2023-08-18 17:48:33 +00:00
|
|
|
jest.mock('./app/lib/database', () => jest.fn(() => null));
|
2022-06-10 20:33:48 +00:00
|
|
|
|
|
|
|
const mockedNavigate = jest.fn();
|
|
|
|
|
|
|
|
jest.mock('@react-navigation/native', () => ({
|
|
|
|
...jest.requireActual('@react-navigation/native'),
|
|
|
|
useNavigation: () => mockedNavigate
|
|
|
|
}));
|
|
|
|
|
|
|
|
jest.mock('react-native-notifications', () => ({
|
|
|
|
Notifications: {
|
|
|
|
getInitialNotification: jest.fn(() => Promise.resolve()),
|
|
|
|
registerRemoteNotifications: jest.fn(),
|
|
|
|
events: () => ({
|
|
|
|
registerRemoteNotificationsRegistered: jest.fn(),
|
|
|
|
registerRemoteNotificationsRegistrationFailed: jest.fn(),
|
|
|
|
registerNotificationReceivedForeground: jest.fn(),
|
|
|
|
registerNotificationReceivedBackground: jest.fn(),
|
|
|
|
registerNotificationOpened: jest.fn()
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}));
|
2022-06-22 12:24:25 +00:00
|
|
|
|
|
|
|
jest.mock('@gorhom/bottom-sheet', () => {
|
|
|
|
const react = require('react-native');
|
|
|
|
return {
|
|
|
|
__esModule: true,
|
|
|
|
default: react.View,
|
|
|
|
BottomSheetScrollView: react.ScrollView
|
|
|
|
};
|
|
|
|
});
|
2022-07-20 21:02:18 +00:00
|
|
|
|
|
|
|
// If you need to manually mock a lib use this mock pattern and set exports.
|
|
|
|
jest.mock('react-native-math-view', () => {
|
|
|
|
const react = require('react-native');
|
|
|
|
return {
|
|
|
|
__esModule: true,
|
|
|
|
default: react.View, // Default export
|
|
|
|
MathText: react.View // {...} Named export
|
|
|
|
};
|
|
|
|
});
|