TanStackT
TanStackโ€ข3y agoโ€ข
4 replies
dangerous-fuchsia

Testing useQuery by mocking it's callback

Hello ๐Ÿ‘‹

I want to test my component by mocking the callback used by useQuery

To do so I use Jest's spyOn function, which should spy on the named exported function and should use the mocked implementation if given.
Well, it should but it don't
I tried several things (can't enumerate them since I've tried a lot of "solutions" ๐Ÿ˜… )

Here is code snippet for your help (in comment)
Was this page helpful?