Testing React web components with Enzyme

At this point, we have tested the backend of our application using both unit tests and integration tests (with SuperTest). We have also tested our client in complete isolation, thanks to the usage of Sinon.JS. However, our application can still fail if something is wrong in the presentation layer (the graphic user interface). In this section, we are going to learn how we can use some libraries to help us to test each of the components of our graphic user interface.

Refer to Chapter 11, Frontend Development with React and TypeScript, to learn more about React.

The companion source code includes the following React component:

import * as React from "react"; import { MathClient } from "./math_client"; ...

Get Learning TypeScript 2.x - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.