DEV Community

Discussion on: React Shallow Snapshot

Collapse
 
wmertens profile image
Wout Mertens

So for FancyButton you would mock all those HOCs and then match the snapshot? And you'd end up with something simpler but still complex enough that it's worth maintaining the test?

Over the years, snapshot tests did find some bugs for me, but mostly because I know what they should look like and I could interpret the changes. I've had to decline PRs where the dev just updated snapshots without interpreting the changes. So I think it's best to use inline snapshots (so it's hard to miss and short-ish) and add some assertions about the most important parts of the snapshots.