Skip to content

Commit

Permalink
fix(project): aff url for card tests
Browse files Browse the repository at this point in the history
  • Loading branch information
olga-jwp committed Jul 26, 2023
1 parent ae61a01 commit 5af16a3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/components/Card/Card.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,23 @@ const itemWithImage = { title: 'This is a movie', duration: 120, cardImage: 'htt

describe('<Card>', () => {
it('renders card with video title', () => {
const { getByText } = renderWithRouter(<Card item={item} onClick={() => ''} url="" />);
const { getByText } = renderWithRouter(<Card item={item} onClick={() => ''} url="https://test.dummy.jwplayer.com" />);
expect(getByText(/aa/i)).toBeTruthy();
});

it('renders tag with correct duration', () => {
const { getByText } = renderWithRouter(<Card item={item} onClick={() => ''} url="" />);
const { getByText } = renderWithRouter(<Card item={item} onClick={() => ''} url="https://test.dummy.jwplayer.com" />);
expect(getByText(/2/i)).toBeTruthy();
});

it('renders the image with the image prop when valid', () => {
const { getByAltText } = renderWithRouter(<Card item={itemWithImage} onClick={() => ''} url="" />);
const { getByAltText } = renderWithRouter(<Card item={itemWithImage} onClick={() => ''} url="https://test.dummy.jwplayer.com" />);

expect(getByAltText('This is a movie')).toHaveAttribute('src', 'http://movie.jpg?width=320');
});

it('makes the image visible after load', () => {
const { getByAltText } = renderWithRouter(<Card item={itemWithImage} onClick={() => ''} url="" />);
const { getByAltText } = renderWithRouter(<Card item={itemWithImage} onClick={() => ''} url="https://test.dummy.jwplayer.com" />);

expect(getByAltText('This is a movie')).toHaveAttribute('src', 'http://movie.jpg?width=320');
expect(getByAltText('This is a movie')).toHaveStyle({ opacity: 0 });
Expand Down

0 comments on commit 5af16a3

Please sign in to comment.