Speaker listing
Following the functionality in our C# backend, we will start by testing a listing of the speakers available. We are not yet ready to connect to the backend and, for any of the tests we will write here as unit tests, we will need to mock the behaviors that the backend would normally present.
For the moment, we are not going to concern ourselves with any kind of authentication. So, the important functionality we will be looking to implement is that when no speakers exist we should let the user know, and when speakers do exist we should list them.
The way that we will produce both situations is through a mock API. As strange as it may seem, most of our business logic will be in the mock API. Because it will be crucial to all of the other tests we will write, we must unit test the mock API as if it were production code.
A mock API service
To begin testing the mock API service, let's create a new services folder and add a mockSpeakerService.spec.js
file.
Inside that file, we need to...