Jest testing Component that is using useRouter() #613
Replies: 1 comment
-
Why is this closed? I don't see an answer and I am struggling with the same thing |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Cheers everyone!
I am trying to test a simple component that is using useRouter() and I ca not solve this error: Couldn't find a navigation object. Is your component inside NavigationContainer?
I have tried to mock the
useRouter
, but it not helped. Also, since I am usingexpo-router
, I do not have'@react-navigation/native
' installed to get theNavigationContainer
- correct me if I can take it from anywhere else.Here is a sample of my code:
Beta Was this translation helpful? Give feedback.
All reactions