Skip to content

Instantly share code, notes, and snippets.

@chsami
Last active February 2, 2019 11:45
Show Gist options
  • Save chsami/cb191e95a5eca422e431ebee8a8768e8 to your computer and use it in GitHub Desktop.
Save chsami/cb191e95a5eca422e431ebee8a8768e8 to your computer and use it in GitHub Desktop.
// delegate to your own implementation
spyOn(MoviesComponent, 'getMovies').and.callFake(() => {});
//delegate to your own implementation with an argument
spyOn(MoviesComponent, 'getMovies').withArgs('').and.callFake(() => {});
//return a specific value 'false'
spyon(MoviesComponent, 'getMovies').and.returnValue({movies: ['terminator', 'titanic', 'avatar']}});
//delegate to the actual implementation
spyOn(MoviesComponent, 'getMovies').and.callThrough();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment