DEV Community

Discussion on: Creating a React component with TDD

mbarzeev profile image
Matti Bar-Zeev Author • Edited on

That's a great question actually, even more so because of the documentation for Jest snapshots claims that they aim to help in testing a rendered UI, but what I found out over the time using snapshot for testing UI components is that it is (1) very hard to maintain, (2) when something breaks you need to look carefully at a complex structure and figure out if you expected that or not, and (3) most importantly for this post subject - you really cannot conduct TTD with snapshots (you can, but it is super hard to do, with low ROI).
I use snapshots to check outputs of serializable objects like arrays or json, you know, cause then it is easier to read and understand where the test failed and why.

_ns2882 profile image
Nikhil Sengar

got it , thanks for a detailed reply