How to use React Testing Library to rewrite an Enzyme Component test

A mini-rewrite case study of two testing libraries

Luke Ghenco
Jan 16, 2019 · 7 min read
The Dream of 100% Test Coverage

Learnings from a recent conversion

Quick Setup Info

The Component(s) we are testing

Step: 1

The original Enzyme test

Step: 2

{mount, shallow} vs render

Looking for similar test patterns

Step: 3
Step: 4
Step: 5

Looking for test paths that we didn’t cover in Enzyme

Step: 6
Step: 7
Step: 8
Step: 9
Step: 10
Step: 11
Step: 12

Checking out the final code coverage using the new tests

Step: 13 — Final

Closing Thoughts

Footer top
Footer bottom

Flatiron Labs

We're the technology team at The Flatiron School (a WeWork…

Flatiron Labs

We're the technology team at The Flatiron School (a WeWork company). Together, we're building a global campus for lifelong learners focused on positive impact.

Luke Ghenco

Written by

Flatiron Labs

We're the technology team at The Flatiron School (a WeWork company). Together, we're building a global campus for lifelong learners focused on positive impact.