Skip to content

Instantly share code, notes, and snippets.

@FunnyGhost
Last active March 12, 2019 15:33
Show Gist options
  • Select an option

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

Select an option

Save FunnyGhost/a5d9e6a382b758a7a656a977c3a2edc3 to your computer and use it in GitHub Desktop.
describe('FavoriteMoviesComponent', () => {
let component: FavoriteMoviesComponent;
let fixture: ComponentFixture<FavoriteMoviesComponent>;
let favoriteMovieService: FavoriteMoviesService;
beforeEach(() => {
fixture = TestBed.createComponent(FavoriteMoviesComponent);
component = fixture.componentInstance;
favoriteMovieService = TestBed.get(FavoriteMoviesService);
jest.spyOn(favoriteMovieService, 'getFavoriteMovies').mockReturnValue(of(favoriteMoviesToUse));
});
describe('Getting the movies', () => {
it('should get the movies from the service', () => {
fixture.detectChanges();
expect(favoriteMovieService.getFavoriteMovies).toHaveBeenCalled();
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment