import { shallow } from 'enzyme'; import { Card, Nav } from 'reactstrap'; import { NavPillItem, NavPills } from '../../src/utils/NavPills'; describe('', () => { it.each([ ['Foo'], [Hi!], [[, Hi!]], ])('throws error when any of the children is not a NavPillItem', (children) => { expect.assertions(1); try { shallow({children}); } catch (e: any) { expect(e.message).toEqual('Only NavPillItem children are allowed inside NavPills.'); } }); it.each([ [undefined], [true], [false], ])('renders provided items', (fill) => { const wrapper = shallow( 1 2 3 , ); const card = wrapper.find(Card); const nav = wrapper.find(Nav); expect(card).toHaveLength(1); expect(card.prop('body')).toEqual(true); expect(nav).toHaveLength(1); expect(nav.prop('pills')).toEqual(true); expect(nav.prop('fill')).toEqual(!!fill); }); });