July 2018
Intermediate to advanced
574 pages
14h 7m
English
We'll now explore how to run the tests that interact with the application's repository separately. At the beginning of this chapter, we created some tests for the %Media{} struct, and seen how we can test the changeset logic without ever touching the database. Now, we'll see how to actually run the tests that hit the database.
A common question that's asked every once in a while is how to create a mock for the repository, so that we can test the functions that interact with it independently. While the repository is indeed another dependency, we think that creating a mock for it makes no sense, because in the repository tests, we want to verify that our commands and queries work as expected. ...