react-native-orientation-locker icon indicating copy to clipboard operation
react-native-orientation-locker copied to clipboard

Jest test fails in the context wrapper

Open ozanmanav opened this issue 4 years ago • 1 comments

Hi, i tried this fix it's working in the another pages but not working with context wrapper should i do another thing for this any idea ?

I'm using in the context wrapper like this:

image

I'm getting this error -> image

ozanmanav avatar Nov 17 '20 10:11 ozanmanav

@ozanmanav Try mocking the module in your tests:

jest.mock('react-native-orientation-locker', () => {
	return {
		addEventListener: jest.fn(),
		removeEventListener: jest.fn(),
		lockToPortrait: jest.fn(),
		lockToLandscapeLeft: jest.fn(),
		lockToLandscapeRight: jest.fn(),
		unlockAllOrientations: jest.fn(),
	};
});

ArnoldoJr avatar Dec 10 '20 23:12 ArnoldoJr