Testing React with Jest, Enzyme and Typescript (Part 3): Shallow

lbrabander
3 min readJan 29, 2021

What is shallow testing

With shallow testing only the component that we are testing will be rendered, child components will not be rendered. When you want to test the component as a unit (unit testing), you should use Shallow. It is not able to test (mounting / unmounting) with Shallow testing.

In this article i’ll show you an example of how to test your components as a unit. We will also mock functions to check if the properties are given to the child components correctly.

--

--