Unit Tests and Snapshots are Fake News

John Stewart - Sep 8 '19 - - Dev Community

Alright, I've been told many times that I'm wrong on this but I can't help but feel the same way every time I write or update one of these things.

When writing a unit test I end up stubbing out an entirely fake environment for a given function to run in. This fake environment yields the results I expect every time because I mocked it to do so. So the test passes or fails as expected.

Same is true for snapshots. When I update a React component's render method. Of course, the snapshots will need to be updated. With this one I can at least see that maybe if I update something not clearly referenced in the render method that it might update a snapshot inadvertently.

To me though these "tests" seem fake and not a true measure of if an app is well tested.

Again, I know I'm wrong but I'd love to hear from others on this because I honestly just don't see the value of these things.

. . . . . .
Terabox Video Player