Writing test code
Though discussing and writing test code is outside the scope of this book, it is crucial for developing reliable software. In this section, first we will look at the testing tools available to test the different parts of a MERN application. Then, to help get started with writing test code for the MERN applications developed in this book, we will also discuss a real example of adding a client-side test to the MERN Social application from Chapter 5, Starting with a Simple Social Media Application.
Testing with Jest
Jest is a comprehensive testing framework for JavaScript. Though it is more commonly known for testing React components, it can be used for general-purpose testing with any JavaScript library or framework. Among the many JavaScript testing solutions in Jest, it provides support for mocking and snapshot testing, comes with an assertion library, and tests in Jest are written in the behavior driven development (BDD) style. Besides testing the React components, Jest...