Created
September 12, 2019 12:52
-
-
Save FunnyGhost/de670fa5ee54c2d7f604548ef16b81b7 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
describe('FavoriteMoviesService', () => { | |
let serviceUnderTest: FavoriteMoviesService; | |
let http: HttpTestingController; | |
beforeEach(() => { | |
TestBed.configureTestingModule({ | |
imports: [HttpClientTestingModule], | |
providers: [FavoriteMoviesService] | |
}); | |
serviceUnderTest = TestBed.get(FavoriteMoviesService); | |
http = TestBed.get(HttpTestingController); | |
}); | |
it('should return the favorite movies from the backend', () => { | |
let result: Movie[] = []; | |
serviceUnderTest.getFavoriteMovies().subscribe(data => { | |
result = data; | |
}); | |
const req = http.expectOne(environment.favoriteUrl); | |
expect(req.request.method).toEqual('GET'); | |
req.flush(moviesToUse); | |
http.verify(); | |
}); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment