Skip to content
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

request: a variant of ToastContainer for testing that is always empty regardless of toasts submitted for consistent snapshot testing #1168

Open
favna opened this issue Oct 17, 2024 · 0 comments

Comments

@favna
Copy link

favna commented Oct 17, 2024

Do you want to request a feature or report a bug?

Feature

What is the current behavior?

For our unit testing we use snapshot testing to ensure no random component changes and to have a text-based view of the component tree during manual review. This often causes problems with Toasts however as we have a lot of async data (using msw in tests) and sometimes toasts are present and sometimes they aren't which then causes the snapshot to fail. We have attempted several workarounds for this issue and for some scenarios these have worked, but ultimately they are hacks and not ideal. If this library could provide a component such as TestToastContainer that functionally works the same as ToastContainer but whose children are always empty so the rendered DOM tree is always the same that would solve our problems.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. Your bug will get fixed much faster if we can run your code and it doesn't have dependencies other than React. Paste the link to your CodeSandbox (https://codesandbox.io/s/new) example below:

N.A.

What is the expected behavior?

N.A.

Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?

react: 18.3.1
react-toastify: 10.0.5

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

No branches or pull requests

1 participant