React testing library - how to test client side using the query client #3429
Unanswered
shannonhochkins
asked this question in
Q&A
Replies: 2 comments
-
Helloo, did you have any advance on this? I am having the same problem :( |
Beta Was this translation helpful? Give feedback.
0 replies
-
Same problem here, If anyone has a solution for this I'd be interested to hear it |
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
-
Whenever i mount a component using the query client, i keep getting
TRPCClientError: No fetch implementation found
which is clearly becuase i need to mock a fetch implementation for jest, however the url structure sent to trpc especially in batch mode can be quite complicated.I was wondering if anyone has any solutions on how to mock requests for trpc in a nice way?
Realistically, i cannot find a single example online of how to test the client side react application with trpc and I would absolutely love some guidance!
I've seen others say "mock the db not the endpoints" but even localised, it's still going to have to make a request to the backend of trpc and then makes the tests pretty hard to manage as opposed to just mocking the expected response right in the test
I just cannot for the life of me figure out how to do so!
Beta Was this translation helpful? Give feedback.
All reactions