import { shallow } from 'enzyme';
import * as React from 'react';
import { TouchableOpacity } from 'react-native';
import sinon from 'sinon';

import { Checkbox } from '~/components';
import { assert } from '~/test/utils';

describe('Checkbox', () => {
  it('simulates click with onPress attr', () => {
    const onPress = sinon.spy();
    const wrapper = shallow(<Checkbox onToggle={onPress} />);
    wrapper.find(TouchableOpacity).simulate('press');
    assert.calledOnce(onPress);
  });
});
