DEV Community

Ankit Utekar
Ankit Utekar

Posted on

When to snapshot ?

I am having hard time understanding valid use cases for Jest snapshot testing.
There are lots of opinionated posts explaining snapshot testing.
Have you used snapshot tests in your projects ? If yes, for what kind of components (functional vs stateful with lots of logic, components that are edited frequently vs components that aren't)? If no, why?

Top comments (1)

Collapse
 
ryancraigmartin profile image
Ryan Craig Martin

It depends on what kind of testing you are planning on doing. For instance I am currently using Jest to test the API gateway for a microservices architecture at my company and using snapshots to validate responses from GraphQL.