2024-05-25 01:03:21 -04:00
|
|
|
import "@testing-library/jest-dom";
|
2024-06-02 01:21:21 -04:00
|
|
|
import { render, screen } from "@testing-library/react";
|
|
|
|
import MovieCard from "../src/common/components/MovieCard.tsx";
|
|
|
|
const movie = {
|
|
|
|
Title: "Dune",
|
|
|
|
Year: "2000",
|
|
|
|
imdbID: "tt0142032",
|
|
|
|
Type: "series",
|
|
|
|
Poster:
|
|
|
|
"https://m.media-amazon.com/images/M/MV5BMTU4MjMyMTkxN15BMl5BanBnXkFtZTYwODA5OTU5._V1_SX300.jpg",
|
|
|
|
};
|
|
|
|
describe("MovieCard Rendering", () => {
|
|
|
|
test("should render with Dune title.", () => {
|
|
|
|
render(<MovieCard movie={movie} />);
|
|
|
|
const movieTitle = screen.getByRole("heading");
|
|
|
|
expect(movieTitle).toHaveTextContent("Dune");
|
|
|
|
});
|
|
|
|
test("should render with Year 2000.", () => {
|
|
|
|
render(<MovieCard movie={movie} />);
|
|
|
|
const movieTitle = screen.getByTestId("MovieCard-Year");
|
|
|
|
expect(movieTitle).toHaveTextContent("2000");
|
|
|
|
});
|
|
|
|
});
|