Chapter 6. Testing Node.js Applications
So far, we have only been testing our code by exercising it manually. This isn't a very sustainable approach as our application becomes larger. Ideally, we should regularly exercise all the functionality of our application to check for regressions. This would quickly become prohibitively time-consuming if we continued to use only manual testing. It is much more effective to maintain a suite of automated tests. These also bring many other benefits, for example, acting as documentation of our code for other developers.
In this chapter, we will cover the following topics:
- Writing automated unit tests for our application
- Introducing new libraries to help us write more descriptive tests
- Seeing how to create and use test doubles in JavaScript
- Exercising our application's web interface using HTTP client tests
- Adding full-stack integration tests using browser automation
- Establishing a structure for writing further tests as we expand our codebase...