-
-
Notifications
You must be signed in to change notification settings - Fork 32.6k
[test] Improve the guide documentation page #17070
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
@liogate Thanks for raising this issue, the test story is an important aspect of the components. I think that we need to revamp this part:
The changes we can actually make to the guide:
|
@liogate Regarding your questions, you can ask them on StackOverflow. Tip: ignore the current page. We are misleading users. |
@liogate Not having adequate guidance for now is blocking some important testing initiatives in several projects I'm working on. Would it be possible to provide links to tests in the project code, or some examples inline in this issue, that we can reference for the use case that you would normally use |
We should just remove the guide and link to older versions of the docs. You should never need to have a special setup for a component library in your tests. If you do then you should reconsider your testing strategy. We've been burnt by enzyme testing as well. This will hit snapshot tests but I think those were a mistep when figuring out testing of react components. For now I would recommend |
@eps1lon If we remove the guide, how can we encourage |
It's less about a specific library. The point is to not test our internals. You should consider those a black box. In goes props, out goes DOM. You're not actually doing something with the returned elements anyway but forwarding them to react-dom.
|
@eps1lon This sounds like a good plan, I would also mention how to handle match media (a link to the section in the useMediaQuery page) and Jest snapshot tests (regarding refs and class names). |
Hello,
I've an issue while reading the documentation of material-ui:
https://material-ui.com/guides/testing/#createmount-options-mount
I can't fully understand how to write my tests with custom styles and with this exemple:
Here is some questions:
MyComponent
should be mounted ?While testing, I ran into this issue:
Error: Uncaught [TypeError: theme.spacing is not a function]
Thank you for your help !
The text was updated successfully, but these errors were encountered: