Replies: 1 comment
-
Turns out there's already an issue filed for this: #781 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hey, I'm trying to test a component that makes a request using SWR. I'm mocking the server with Mock Service Worker.
I created a simple fetcher function that throws an error if the request returns a status code of 2xx. The App component renders different text depending on if SWR returns the error from the fetcher function. Below is the example I just described:
I expect both these tests to pass however only the first X passes. If I remove test X, then test Y passes. If X is present, no error is thrown in the Y. I assumed this may have been a caching issue however as you can see above cache.clear() is called after every test. Am I missing something? Thanks
Beta Was this translation helpful? Give feedback.
All reactions