-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
Node.js Design Patterns - Fourth Edition
By :
In our previous example, we executed a SQL query through a database client, and, in our unit tests, we replaced that client with a mock. This allowed us to isolate the business logic and test it independently. But it also raises two important questions:
This is where integration tests come into play.
Integration tests allow us to move beyond isolated units of code and verify how different components (such as our business logic and our database) work together in practice. They help us test the real flow, using real inputs, real queries, and real infrastructure (like an actual SQLite database), giving us confidence that everything behaves correctly as a system.
In this section, we’ll explore how to write...