Last active
May 18, 2020 15:02
-
-
Save vs0uz4/11c039e342a0a211d06e0b3dd13c6a0b to your computer and use it in GitHub Desktop.
renders movie list with 2 movies even when the list contains more movies but only 2 of them contain backdrop_path
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
import '@testing-library/jest-dom/extend-expect'; | |
import { render, fireEvent, getAllByTestId } from '@testing-library/svelte'; | |
import MovieList from '../components/movies/MovieList'; | |
import { store, INITIAL_STATE } from '../store'; | |
import moviesMock from './mocks/movies.json'; | |
describe("Movie List", () => { | |
it("renders movie list with 2 movies even when the list contains more movies but only 2 of them contain backdrop_path", () => { | |
setStore({ movies: moviesMock.results }); | |
const { getByTestId, getAllByTestId } = render(MovieList); | |
const movieItems = getAllByTestId('movie-item'); | |
const movies = moviesMock.results; | |
expect(getByTestId('movie-list')).toBeInTheDocument(); | |
expect(movieItems).toHaveLength(2); | |
expect(movieItems.length).toBeLessThan(movies.length); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment