Skip to content

Instantly share code, notes, and snippets.

@dherges
Created August 17, 2017 19:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dherges/d109cce85eb203ce74a1f5d73a0abcc3 to your computer and use it in GitHub Desktop.
Save dherges/d109cce85eb203ce74a1f5d73a0abcc3 to your computer and use it in GitHub Desktop.
Angular HttpClient (4)
describe(`FakeHttpClientResponses`, () => {
it(`should respond with fake data`, async(inject([HttpClient, HttpTestingController],
(http: HttpClient, backend: HttpTestingController) => {
http.get('/foo/bar').subscribe((next) => {
expect(next).toEqual({ baz: '123' });
});
backend.match({
url: '/foo/bar',
method: 'GET'
})[0].flush({ baz: '123' });
})));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment