I want to mock a native module for jest test case.
I tried this -
jest.mock('NativeModules', () => {
return {
UtilityFunc.getConstants: jest.fn(),
};
});
I know we can't access a property in such a way. My Native module is UtilityFunc and my property is getConstant that returns appversion.
react-native-device-info - I'm using this library as native module for internal stable usage.
Pls share how to use mock with nativeModules in react native.
In my project, I have createCalendarEvent native event, and in that, I am getting promise, this is how you can mock your event.