Skip to content

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

Closed
eelkevdbos opened this issue Feb 3, 2022 · 6 comments · Fixed by #1404
Closed

Comments

@eelkevdbos
Copy link
Contributor

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:

beforeAll(() => {
    useAxios.configure({cache: false})
})

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

@simoneb
Copy link
Owner

simoneb commented Feb 3, 2022

It would be great to include this in the docs. Would you like to send a PR?

@eelkevdbos
Copy link
Contributor Author

Yes, I'll work on one 👍

@simoneb
Copy link
Owner

simoneb commented Feb 16, 2022

@eelkevdbos any updates?

@github-actions github-actions bot added the Stale label Apr 18, 2022
@simoneb simoneb reopened this Apr 26, 2022
@simoneb simoneb removed the Stale label Apr 26, 2022
@github-actions github-actions bot added the Stale label Jun 26, 2022
@github-actions github-actions bot closed this as completed Jul 4, 2022
@simoneb simoneb reopened this Jul 4, 2022
@simoneb simoneb removed the Stale label Jul 4, 2022
@github-actions github-actions bot added the Stale label Sep 3, 2022
@simoneb simoneb reopened this Sep 10, 2022
@simoneb simoneb removed the Stale label Sep 10, 2022
@github-actions github-actions bot added the Stale label Nov 10, 2022
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Nov 18, 2022
@simoneb simoneb reopened this Nov 18, 2022
@simoneb simoneb removed the Stale label Nov 18, 2022
@github-actions github-actions bot added the Stale label Jan 18, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jan 26, 2023
@simoneb simoneb reopened this Jan 26, 2023
@simoneb simoneb removed the Stale label Jan 26, 2023
@github-actions github-actions bot added the Stale label Mar 28, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Apr 5, 2023
@simoneb simoneb reopened this Apr 5, 2023
@github-actions github-actions bot removed the Stale label Apr 6, 2023
@github-actions github-actions bot added the Stale label Jun 5, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jun 12, 2023
@simoneb simoneb reopened this Jun 12, 2023
@simoneb simoneb removed the Stale label Jun 12, 2023
@github-actions github-actions bot added the Stale label Aug 12, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Aug 20, 2023
@simoneb simoneb removed the Stale label Aug 20, 2023
@simoneb simoneb reopened this Aug 20, 2023
@eelkevdbos
Copy link
Contributor Author

@simoneb, is this still relevant? If it is, I can make some time today for a PR on the docs.

@simoneb
Copy link
Owner

simoneb commented Aug 21, 2023

@eelkevdbos it would be great if you could do it!

@github-actions
Copy link

🎉 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
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants