I’m trying to use Jest to test a React Native / Expo project. I’m trying to mock the parts where a file accesses Parse but I keep getting errors like ‘applicationId not found’.
This is basically how I’m mocking Parse:
global.Parse = {
applicationId: 'testAppId',
User: {
currentAsync: jest.fn().mockResolvedValue({
getUsername: () => 'dummyUser'
})
}
};
…and I seem to need to do this at the top of the test file or else import Parse from 'parse/react-native.js'
freaks things out:
jest.mock("parse/react-native.js", () => jest.fn());
…any tips?