import React from 'react';
import renderWithTheme from '../../../testUtils/renderWithTheme';

import Card from '../index';

describe('rendering', () => {
  it('renders card with header, content, extra and img', () => {
    const { getByText, getByAltText } = renderWithTheme(
      <Card
        header="Card header"
        content="Card content"
        extra="Card extra"
        imageSrc="img_url"
      />
    );
    expect(getByText('Card header')).toBeInTheDocument();
    expect(getByText('Card content')).toBeInTheDocument();
    expect(getByText('Card extra')).toBeInTheDocument();
    expect(getByAltText('card-img')).toBeInTheDocument();
  });

  it('renders custom card', () => {
    const { getByText, getByAltText } = renderWithTheme(
      <Card>
        <img src="url" alt="header-img" />
        <p>Some custom content</p>
      </Card>
    );
    expect(getByText('Some custom content')).toBeInTheDocument();
    expect(getByAltText('header-img')).toBeInTheDocument();
  });
});
