-
Notifications
You must be signed in to change notification settings - Fork 27
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
Better snapshot tests #57
Comments
Any particular reason you're interested in snapshot tests over unit tests with something like react-testing-library? I haven't experimented with it before, but it should be possible to mock the modules that import those routing components and replace them with trivial implementations that don't really work, but are testable nonetheless. |
So when it comes to testing UIs, I find they become insanely brittle and so I prefer to test them with the ol' head cameras rather than being declarative about it. That said, the whole thing here is totally lacking in the test department and I know that needs to improve - this ticket was just to cover the fact that we want to have full snapshot coverage and right now we don't. These tests have actually saved me from a few silly mistakes during development, despite being something I've not put too much effort into. To clarify then: you are absolutely right, I need to add some unit tests for the UIs (I do have unit tests for the non-UI stuff) but this ticket is purely about snapshot tests. |
That testing lib I linked is supposed to be less brittle than most because it only lets you test things as if you were using the ol' head cameras. There's no testing internal state, most tests I've used it for don't even use css selectors. I can whip up a few tests with it and you can see how you like them, but I've found it immensely helpful for unit testing UIs. I've refactored huge chunks of stuff and not had to touch a single test, because it eschews testing internals. |
Cheers m8 :) I will take a look. |
We have some snapshot tests, but theyr'e not particularly good - specifically;
We want snapshot tests, but cant' really get those on things like the cocktailItem without introducing enzyme to use its
mount
functionality, or introducing things like the react-routerMemoryRouter
functionaity into the tests.Lets spend some time making this good :)
The text was updated successfully, but these errors were encountered: