In writing unit tests for DoctorService, the following is required to be done:
- Test double for HTTP service: The HTTP service needs to be faked or stubbed. In other words, there is a need to use fake functions/APIs in place of the HTTP service APIs such as GET. This is primarily because what needs to be tested is the code within the DoctorService APIs, and not the external services such as the HTTP service. The following code represents the usage of a factory function that creates an HTTP instance that makes use of MockBackend and BaseRequestOptions.
- Fake server: In addition to the fake HTTP service, there is also a need to create a fake backend server. This is where Angular testing utilities such as MockBackend ...