Skip to content

Instantly share code, notes, and snippets.

@FunnyGhost
Created September 12, 2019 13:06
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 FunnyGhost/13f9788e3cc7ba9fac6ee2d24419d807 to your computer and use it in GitHub Desktop.
Save FunnyGhost/13f9788e3cc7ba9fac6ee2d24419d807 to your computer and use it in GitHub Desktop.
it('should throw if the backend returns an error ', () => {
let bubblesUpTheError = false;
serviceUnderTest.getFavoriteMovies().subscribe(() => {}, () => (bubblesUpTheError = true));
const req = http.expectOne(environment.favoriteUrl, 'expected to make a request');
expect(req.request.method).toEqual('GET');
req.flush('ERROR', { status: 500, statusText: 'Internal server error' });
expect(bubblesUpTheError).toBeTruthy();
http.verify();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment