Testing Component that uses UseQuery hook
Hello !
I don't know if I'm following the right logic on this, do not hesitate to tell me i'm wrong.
I have a component that uses the data from a custom useQuery to conditionally render the content of my page.
I want to test the different outputs of my component which depends on the result of my useQuery.
Right now, I have my QueryProvider setup, my axios call is mocked, but when I try to assert on what my component render, I get an error as data is considered undefined.
I'm considering mocking the useQuery as I can already verify the hook itself in another test. Would that be correct, and if so, how can I do that in Typescript ?
The error:
I'll put the code samples in the thread. (i'll check if I can quickly reproduce a codesandbox)
Thanks
I don't know if I'm following the right logic on this, do not hesitate to tell me i'm wrong.
I have a component that uses the data from a custom useQuery to conditionally render the content of my page.
I want to test the different outputs of my component which depends on the result of my useQuery.
Right now, I have my QueryProvider setup, my axios call is mocked, but when I try to assert on what my component render, I get an error as data is considered undefined.
I'm considering mocking the useQuery as I can already verify the hook itself in another test. Would that be correct, and if so, how can I do that in Typescript ?
The error:
I'll put the code samples in the thread. (i'll check if I can quickly reproduce a codesandbox)
Thanks