Data Not Resolving When Running useQuery
in a Jest Test Environment
#6017
-
Hello! I have the following component that works as intended: MyComponent.tsx
And I am trying to write a unit test for it, using React Testing Library & Jest, by mocking an axios instance and returning test data: MyComponent.test.tsx
But when I run this test:
It seems like whatever I try to do, I can't get Is there anything I'm missing to get this working in my test environment? Any hints would be greatly appreciated! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
checkout the repo at the end of my blopost about testing: https://tkdodo.eu/blog/testing-react-query It has working tests for both components and custom hooks with jest and react-testing-library. |
Beta Was this translation helpful? Give feedback.
checkout the repo at the end of my blopost about testing: https://tkdodo.eu/blog/testing-react-query
It has working tests for both components and custom hooks with jest and react-testing-library.