/*
This is an example of a test for a Control Component inside of Redux Form
*/

import React from 'react';
import ComponentToBeTested from '../ComponentToBeTested';
import configureStore from 'redux-mock-store';
import { Provider } from 'react-redux';
import { mount } from 'enzyme';
import { reduxForm } from 'redux-form';
import sinon from 'sinon';

describe('ComponentToBeTested', () => {
	const store = configureStore()({
		define: 'it according to your needs',
		form: {
			testForm: {
				values: {
					define: 'default values of redux-form'
				}
			}
		}
	});

	const spy = sinon.spy();
	const props = {
		onChange: spy,
	};

	const ComponentWithProps = someProps => {
		return <ComponentToBeTested {...props} />;
	};

	const ReduxForm = reduxForm({
		form: 'testForm',
	})(ComponentWithProps);

	const wrapper = mount(
		<Provider store={store}>
			<ReduxForm />
		</Provider>,
	);

	it(`should have a component X with name`, () => {
		const expectedProp = '?';
		const component = wrapper.find('put your component name here');
		expect(component.node.props.name).toEqual(expectedProp);
	});