import React from 'react';
import { shallow } from 'enzyme';
import Checkbox from './Checkbox';
import { CHECKBOX_ICON_ID } from '../../../constants/test-ids';
import { IconName } from '../Icon';
describe('Checkbox', () => {
it('should render correctly', () => {
const wrapper = shallow();
expect(wrapper).toMatchSnapshot();
});
it('should render correct icon when selected', () => {
const wrapper = shallow();
const iconComponent = wrapper.findWhere(
(node) => node.prop('testID') === CHECKBOX_ICON_ID,
);
const iconName = iconComponent.props().name;
expect(iconName).toBe(IconName.CheckBoxOnFilled);
});
it('should render correct icon when not selected', () => {
const wrapper = shallow();
const iconComponent = wrapper.findWhere(
(node) => node.prop('testID') === CHECKBOX_ICON_ID,
);
const iconName = iconComponent.props().name;
expect(iconName).toBe(IconName.CheckBoxOffOutline);
});
});