-
Notifications
You must be signed in to change notification settings - Fork 130
Response contamination when using axios-hooks with testing-library due to LRU cache #726
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
It would be great to include this in the docs. Would you like to send a PR? |
Yes, I'll work on one 👍 |
@eelkevdbos any updates? |
@simoneb, is this still relevant? If it is, I can make some time today for a PR on the docs. |
@eelkevdbos it would be great if you could do it! |
🎉 This issue has been resolved in version 5.0.0 🎉 The release is available on: Your optic bot 📦🚀 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The useAxios hook uses a LRU cache by default. When writing tests, the cache is not invalidated between tests (at least not with testing-library). This makes previous responses "bleed" into subsequent tests. This behavior can easily be disabled in the test suite setup with the following:
I'm not sure if it deserves a place in the docs, but I thought I would mention it here to -- possibly -- save someone a bit of time.
Reference to the issue I originally landed on: testing-library/react-testing-library#716
The text was updated successfully, but these errors were encountered: