Snapshot Testing with Jest

Image for post
Image for post

Design Systems are pretty popular nowadays. As you company grows and has multiples apps/sites and products you new have a consistent experience across your brand. Having components is a great architectural pattern to help you to deliver the design system to code. However coding tests for a design system component can be very time consuming and super expensive. IF you are using React, Jest is really your natural choice. Jest can let you do both Example based testing but also Snapshot testing. Snapshot testing can be amazing or complete waste really depends on what you use for. For Error messages snapshotting testing be super useful but for testing design system components is IMHO the killer use case. Jest has great tooling and make you life as an engineer, dealing with snapshots super easy and fun. So I made a video about Jest and React. Let’s get started.

Video

Code

Cheers,

Diego Pacheco

Originally published at http://diego-pacheco.blogspot.com on August 2, 2020.

Written by

Brazilian, Software Architect, SWE(Java, Scala, Rust, Go) SOA & DevOps expert, Author. Working with EKS/K8S. diegopacheco.github.io (Opinions on my own)

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store