Replies: 4 comments
-
Also interested in this! |
Beta Was this translation helpful? Give feedback.
-
I'm just coming back to this as I'm about to embark on a bit more test writing. Any thoughts from the community on testing hooks? Should we mock server responses or try to set up integration tests? |
Beta Was this translation helpful? Give feedback.
-
i'm trying to figure out how to do this now too. no luck yet. I need to mock a useQuery response |
Beta Was this translation helpful? Give feedback.
-
maybe the best answer is to put the useQuery in a custom hook and just mock that custom hook instead. |
Beta Was this translation helpful? Give feedback.
-
I have some components that make use of useQuery hooks to get data from my trpc server.
I've currently got a little unit test for them where I mock the useQuery response.
I'm wondering if it's recommended also to have more of an integration test where useQuery hits the api live and if so what is the best way to set up a test like this?
My trpc api is on an express server.
Beta Was this translation helpful? Give feedback.
All reactions