Hi,
Here is the index page and i am getting data from a custom hook that is wrapped by useSWR hook.
Now i want to write tests for index page by mocking the custom hook.(mock service worker can help here ?) stackblitz.com/edit/nextjs-gcee4q?...
Well, I think I understand where you struggle with it, so I took the opportunity to write a post about it here - dev.to/mbarzeev/mocking-data-fetch...
Hope this helps :)
For further actions, you may consider blocking this person and/or reporting abuse
We're a blogging-forward open source social network where we learn from one another
This is good. This is pure tests on custom hook. Can you use that custom hook in any component and write a test case for the component.
I am trying to do that, i get undefined from the custom hook on the component.
Can you help me with this scenario.
Thanks.
Hi, can you please share some code (on github fir instance) so I can understand more what it is you're trying to do?
Hi,
Here is the index page and i am getting data from a custom hook that is wrapped by useSWR hook.
Now i want to write tests for index page by mocking the custom hook.(mock service worker can help here ?)
stackblitz.com/edit/nextjs-gcee4q?...
Well, I think I understand where you struggle with it, so I took the opportunity to write a post about it here - dev.to/mbarzeev/mocking-data-fetch...
Hope this helps :)