Tests Call the API as a User Would—Setting Up
Let’s start setting up to test our API by incorporating persistence into it.
Our test will deal with the entire Mastery API this whole course has been spent building. This test will not exercise our code as an interior function might. Instead, it will test the entire API as an end-user of the dependency.
We plan to cover tests for the overarching API and then move to more specific tests within the poncho project. In this chapter, we won’t make an exhaustive test to cover every corner condition. Instead, we’ll go over the strategies we might use to meet the testing strategies we’re likely to face to build effective boundary tests. Let’s write the first test.
Test the external API
It’s finally time to override the pristine mastery_test.exs
that mix
created when we built the initial Mastery project. This test is designed to exercise the external API that allows access to external dependencies.
Module, headings, and aliases
We’ll work from the outside in and crack open /test/mastery_test.exs
now:
Get hands-on with 1200+ tech skills courses.