December 2021
Intermediate to advanced
510 pages
11h 20m
English
Now that you have both implementations for the Pomodoro business logic and the in-memory repository, let’s write some tests for the business logic.
For brevity, you’ll add tests for the business logic only, which will indirectly test the repository when it’s used. For a real production application, we recommend that you write unit tests for the repository implementation as well.
Some of these tests require access to the repository. Because you can have different implementations of the repository, first let’s create a helper function getRepo to get an instance of the repository. You can implement different versions of this function for the different repository implementations without changing the test code. ...
Read now
Unlock full access