Last active
March 12, 2019 15:30
-
-
Save FunnyGhost/fb42c3925d1fcd9f3c7bb54b17f9b6e3 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
const favoriteMoviesToUse: Movie[] = [ | |
{ title: 'Interstellar' } as Movie, | |
{ title: 'The big Lebowski' } as Movie, | |
{ title: 'Fences' } as Movie | |
]; | |
describe('FavoriteMoviesComponent', () => { | |
beforeEach(() => { | |
fixture = TestBed.createComponent(FavoriteMoviesComponent); | |
component = fixture.componentInstance; | |
component.favoriteMovies = favoriteMoviesToUse; | |
}); | |
describe('Render', () => { | |
it('show all the favorite movies', () => { | |
const movieElements = fixture.debugElement.queryAll(By.css('.movie')); | |
expect(movieElements.length).toBe(favoriteMoviesToUse.length); | |
}); | |
it('should show the movie titles', () => { | |
const movieElements = fixture.debugElement.queryAll(By.css('.movie')); | |
movieElements.forEach((movieElement: DebugElement, index) => { | |
expect(movieElement.nativeElement.innerHTML).toContain(favoriteMoviesToUse[index].title); | |
}); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment