HttpTestingController

Controller to be injected into tests, that allows for mocking and flushing of requests.

abstract class HttpTestingController {
  abstract match(match: string | RequestMatch | ((req: HttpRequest<any>) => boolean)): TestRequest[]
  abstract expectOne(url: string, description?: string): TestRequest
  abstract expectNone(url: string, description?: string): void
  abstract verify(opts?: { ignoreCancelled?: boolean; }): void
}

Related concepts

HttpTestingController

HttpTestingController — Structure map

Clickable & Draggable!

HttpTestingController — Related pages: