Part 2. Writing tests

 

The first part of this book reads like a course on culinary history; the second reads like a complete cooking guide that includes plenty of pictures and detailed recipes.

Part 2 will use practical examples to teach you how to test different types of JavaScript applications. In this part, you will write plenty of different kinds of tests, learn techniques to make your tests reliable and maintainable, and understand which tools to use in each situation and how those tools work.

In chapter 3, you will learn techniques for organizing your tests more comprehensively, writing flexible and reliable assertions, isolating and instrumenting different parts of your code, and determining what to test and what not to. These techniques will help you gather more informative feedback and reduce your tests’ costs without compromising on their ability to detect mistakes.

Chapter 4 teaches you how to test backend applications. In it, you will learn how to test your backend’s API routes and middlewares and how to deal with external dependencies, such as databases or third-party APIs.

Chapter 5 covers advanced backend testing techniques that will help you make your tests quicker and reduce their cost while preserving your test’s reliability. In this chapter, you will learn how to run tests concurrently, eliminate nondeterminism, and efficiently architect your test suites.