import React from 'react';
import { render } from '@testing-library/react';
import FormTestBase from '../../__Tests__/FormTestBase';
import IconInputGroup from '../IconInputGroup';

describe('IconInputGroup', () => {
  it('renders without crashing', () => {
    render(
      <FormTestBase>
        {({ Field }) => (
          <Field
            name="nameWithIcon"
            Component={IconInputGroup}
            icon={<span>Pretend this is an icon</span>}
          />
        )}
      </FormTestBase>
    );
  });

  it('has matching snapshot', () => {
    const renderResult = render(
      <FormTestBase>
        {({ Field }) => (
          <Field
            name="nameWithIcon"
            Component={IconInputGroup}
            icon={<span>Pretend this is an icon</span>}
          />
        )}
      </FormTestBase>
    );
    expect(renderResult.asFragment()).toMatchSnapshot();
  });
});
