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 import our assertion library, create our initial describe, and write an existence test.

import { expect } from 'chai'; describe('Mock Speaker Service', () => {  it('exits', () => {    expect(MockSpeakerService).to.exist;  });});

Start the npm test script with watch. The test we just wrote should fail. To make the test pass, we must create a MockSpeakerService object. Let's play devil's advocate a little and create an object in this file, but only enough of an object to make the test pass.

let MockSpeakerService = {};

This line passes the currently failing test, but clearly isn't what ...

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.