import React from 'react'; import { shallow } from 'enzyme'; import { Badge } from '../'; describe('Badge', () => { it('should render a span by default', () => { const wrapper = shallow(Yo!); expect(wrapper.type()).toBe('span'); }); it('should render an anchor when when href is provided', () => { const wrapper = shallow(Yo!); expect(wrapper.type()).toBe('a'); }); it('should render a custom tag when provided', () => { const wrapper = shallow(Yo!); expect(wrapper.type()).toBe('main'); }); it('should render children', () => { const wrapper = shallow(Yo!); expect(wrapper.text()).toBe('Yo!'); }); it('should render badges with secondary color', () => { const wrapper = shallow(Default Badge); expect(wrapper.hasClass('badge-secondary')).toBe(true); }); it('should render Badges with other colors', () => { const wrapper = shallow(Danger Badge); expect(wrapper.hasClass('badge-danger')).toBe(true); }); it('should render Badges as pills', () => { const wrapper = shallow(Pill Badge); expect(wrapper.hasClass('badge-pill')).toBe(true); }); });