import { createRef } from 'react';

import { render, screen } from '../../test-utils';

import Option from '.';

describe('Option', () => {
  it('renders the title', () => {
    render(<Option title="Option title" content="" media={<span />} button={<span />} />);

    expect(() => screen.getByText('Option title')).not.toThrow();
  });

  it('`ref` attribute is passed to Option and reference is created', () => {
    const reference = createRef<HTMLElement | HTMLAnchorElement>();

    expect(reference.current).toBeFalsy();
    render(<Option ref={reference} title="" content="" media={<span />} button={<span />} />);
    expect(reference.current).toBeTruthy();
  });
});
