// @flow
import React from 'react';
import { mountWrappedComponent, renderSnapshot } from '../../../../utils/tests';
import { RadioOption } from '.';

describe('RadioOption', () => {
  describe('snapshots', () => {
    it('matches checked snapshot', () => {
      const svgComponent = renderSnapshot(
        <RadioOption checked className="test" />,
      );

      expect(svgComponent).toMatchSnapshot();
    });

    it('matches unchecked snapshot', () => {
      const svgComponent = renderSnapshot(<RadioOption checked={false} />);

      expect(svgComponent).toMatchSnapshot();
    });
  });

  it('shows the checked svg when checked is true', () => {
    const wrapper = mountWrappedComponent(<RadioOption checked />);

    expect(wrapper.find('RadioChecked').exists()).toBe(true);
    expect(wrapper.find('RadioUnchecked').exists()).toBe(false);
  });

  it('shows the unchecked svg when checked is false', () => {
    const wrapper = mountWrappedComponent(<RadioOption checked={false} />);

    expect(wrapper.find('RadioChecked').exists()).toBe(false);
    expect(wrapper.find('RadioUnchecked').exists()).toBe(true);
  });
});
