Created
September 12, 2019 13:06
-
-
Save FunnyGhost/13f9788e3cc7ba9fac6ee2d24419d807 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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