How to mock RNS with Jest #838
-
Hi Has anyone come up with a way to mock RNS? Jest is blowing up with the following error
|
Beta Was this translation helpful? Give feedback.
Answered by
kacperkapusciak
Mar 1, 2021
Replies: 1 comment 1 reply
-
Hey @getinnocuous, jest.useFakeTimers();
jest.mock('react-native-screens', () => {
const RealComponent = jest.requireActual('react-native-screens');
RealComponent.enableScreens = function () {};
RealComponent.screensEnabled = function () {
return true;
};
return RealComponent;
}); If you want to know more about this see: #247 (comment) and this: jestjs/jest#6434 (comment) If this snippet doesn't help please provide us with some code to reproduce your problem. Cheers! |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
kacperkapusciak
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey @getinnocuous,
try this snippet:
If you want to know more about this see: #247 (comment) and this: jestjs/jest#6434 (comment)
If this snippet doesn't help please provide us with some code to reproduce your problem. Cheers!