Put in order · Angular course · Module 11: Testing

Order of testing an HTTP request

Arrange the steps of testing an HTTP request in a service test (top to bottom):

Items to put in order

  • const req = httpMock.expectOne('/api/samurai');
  • req.flush(mockData);
  • expect(req.request.method).toBe('GET');
  • service.getAll().subscribe(data => expect(data).toEqual(mockData));

You can check the correct answer by solving this task in the CodeWorlds game.