import React from 'react';

import Form from './index';

const mockCallback = jest.fn();

const data = {
  onSubmit: mockCallback,
};

describe('Form', () => {
  const defaultElement = <Form {...data} />;
  let wrapper;

  beforeEach(() => {
    wrapper = shallow(defaultElement);
  });

  it('should render correctly', () => {
    expect(wrapper).toMatchSnapshot();
  });

  it('should fire onSubmit event', () => {
    const form = wrapper.find('form');
    form.simulate('submit');
    expect(mockCallback.mock.calls.length).toBe(1);
  });
});
