import * as React from 'react'; import { shallow } from 'enzyme'; import Badge from '../Badge'; import { BadgeType } from '../types'; describe('components/badge/Badge', () => { test('should correctly render children in badge', () => { const children = 'some child text'; const wrapper = shallow({children}); expect(wrapper.hasClass('badge')).toBe(true); expect(wrapper.text()).toEqual(children); }); test('should accept and propagate className when className prop passed', () => { const wrapper = shallow(test); expect(wrapper.hasClass('some-badge-style')).toBe(true); }); test.each([BadgeType.INFO, BadgeType.WARNING, BadgeType.HIGHLIGHT])( `should render a badge with %s styling when initialized`, type => { const wrapper = shallow(test); expect(wrapper).toMatchSnapshot(); }, ); });