// @flow
import React from 'react';
import { expect } from 'chai';
import { mount } from 'enzyme';
import sinon from 'sinon';
import { spies } from '../../test';

import C from './DeleteInputBtn.jsx';

describe('<DeleteInputBtn />', () => {
	let wrapper;
	afterEach(() => {
		if(wrapper && wrapper.unmount)
			wrapper.unmount();
	});

	it('takes a "deleteFunc" prop', () => {
		const deleteFunc = sinon.spy();
		wrapper = mount(<C deleteFunc={deleteFunc} />);
		expect(wrapper).to.have.prop('deleteFunc', deleteFunc);
	});

	it('calls the deleteFunc when clicked', () => {
		const deleteFunc = sinon.spy();
		wrapper = mount(<C deleteFunc={deleteFunc} />);
		wrapper.find('button').simulate('click');
		expect(deleteFunc.calledOnce).to.equal(true);
	});
});
