Introduction
Test doubles help us check parts of our code by pretending to be other parts. They make testing easier and safer.
When you want to test a function without calling a real database.
When you want to check if a function calls another function correctly.
When you want to simulate different responses from a service without using the real one.
When you want to isolate a part of your code to find bugs easily.