import React from 'react'; import { shallow, mount } from 'enzyme'; import { shallowToJson } from 'enzyme-to-json'; import { Form } from '../src'; import { schema, uiSchema, formData } from '../src/Form/stories/schema'; describe('Form', function() { it('renders correctly', () => { const wrapper = shallow(
); expect(shallowToJson(wrapper)).toMatchSnapshot(); }); it('renders with primary button', () => { const wrapper = shallow( ); expect(shallowToJson(wrapper)).toMatchSnapshot(); }); it('renders with no button', () => { const wrapper = shallow( ); expect(shallowToJson(wrapper)).toMatchSnapshot(); }); it('should handle the submit event', () => { const onSubmit = jest.fn(); const wrapper = mount( ); wrapper.find('form').simulate('submit'); expect(onSubmit).toBeCalled(); }); });