Mocking the server

Now that we have fixed our existing tests, we are ready to start writing tests for our real service, the fetchSpeakerService. Let's get started by looking at the test we used for our mock service. The tests will largely be the same as we are trying to achieve the same pattern of functionality.

First, we will want to create the test file fetchSpeakerService.spec.js. Once the file is created, we can add the standard existence test:

describe('Fetch Speaker Service', () => {   it('exits', () => {     expect(FetchSpeakerService).to.exist;   }); });

Because we stubbed out the fetch speaker service earlier, this test should just pass after we add the appropriate import.

Following the mock speaker service tests, the next test is a construction ...

Get Improving your C# Skills now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.