Closed dsagredo closed 3 years ago
nope, that is a jest question.
mock react-native-contacts
inside test file
jest.mock('react-native-contacts', () => ({
checkPermission: jest
.fn()
.mockImplementation(() => Promise.resolve('undefined')),
getAll: jest.fn().mockImplementation(() => Promise.resolve([])),
requestPermission: jest
.fn()
.mockImplementation(() => Promise.resolve('undefined')),
getContactsMatchingString: jest
.fn()
.mockImplementation(() => Promise.resolve([])),
}));
and mock react-native-permissions
also in jest.setup.js
or on top of test file
jest.mock('react-native-permissions', () =>
require('react-native-permissions/mock'),
);
Any solutions or advice on how to mock both components with Jest, and not just one? I am very new to Jest.