Skip to content

Instantly share code, notes, and snippets.

@FunnyGhost
Created December 5, 2019 11:00
Show Gist options
  • Select an option

  • Save FunnyGhost/bcf653e7618bc5e5b31fcb5dc08897bb to your computer and use it in GitHub Desktop.

Select an option

Save FunnyGhost/bcf653e7618bc5e5b31fcb5dc08897bb to your computer and use it in GitHub Desktop.
it('should delete a favorite movie when the user wants to', () => {
jest.spyOn(favoriteMovieService, 'deleteMovie');
const favoriteMovieToDelete = favoriteMoviesToUse[0];
const componentToDelete = fixture.debugElement.queryAll(
By.directive(FavoriteMovieComponent)
)[0].componentInstance as FavoriteMovieComponent;
componentToDelete.deleteMovie.emit(favoriteMovieToDelete);
expect(favoriteMovieService.deleteMovie).toHaveBeenCalledWith(favoriteMovieToDelete);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment