Chapter 11: Writing Tests for React and Node.js

So far, we've written a lot of code and come across a variety of problems. We haven't yet implemented automated testing for our software; however, it's a common approach to make sure everything works after making changes to your application. Automated testing drastically improves the quality of your software and reduces errors in production.

To achieve this, we will cover the following main topics in the chapter:

  • How to use Mocha for testing
  • Testing the GraphQL application programming interface (API) with Mocha and Chai
  • Testing React with Enzyme and JSDOM

Technical requirements

The source code for this chapter is available in the following GitHub repository:

https://github.com/PacktPublishing/Full-Stack-Web-Development-with-GraphQL-and-React-Second-Edition/tree/main/Chapter11 ...

Get Full-Stack Web Development with GraphQL and React - 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.