You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, if I directly use my Get() method, I also get the console.log in there (and an error saying that I am not catching my fetch, which makes sense). I'd expect the above code to return two console.logs and also error to say that I've not caught my fetch in Get().
I've been bashing my head on this for a while! I've used Nock without any issues, but it doesn't seem to work nicely with SWR for some reason. Hopefully I'm just missing something silly!
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I'm trying to mock my SWR results in my tests, but it doesn't appear to get into my fetcher.
Here is my SWR code:
Here is my fetcher:
And here is my test:
The only console.log I get is the one in my test:
However, if I directly use my
Get()
method, I also get the console.log in there (and an error saying that I am not catching my fetch, which makes sense). I'd expect the above code to return two console.logs and also error to say that I've not caught my fetch inGet()
.I've been bashing my head on this for a while! I've used Nock without any issues, but it doesn't seem to work nicely with SWR for some reason. Hopefully I'm just missing something silly!
Any help would be amazing :)
Beta Was this translation helpful? Give feedback.
All reactions