index.spec.jsx 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. import React from 'react';
  2. import {shallow} from 'enzyme';
  3. import IdBadge from 'app/components/idBadge';
  4. describe('IdBadge', function() {
  5. let routerContext = TestStubs.routerContext();
  6. it('renders the correct component when `user` property is passed', function() {
  7. let wrapper = shallow(<IdBadge user={TestStubs.User()} />, routerContext);
  8. expect(wrapper.find('UserBadge')).toHaveLength(1);
  9. });
  10. it('renders the correct component when `team` property is passed', function() {
  11. let wrapper = shallow(<IdBadge team={TestStubs.Team()} />, routerContext);
  12. expect(wrapper.find('TeamBadgeContainer')).toHaveLength(1);
  13. });
  14. it('renders the correct component when `project` property is passed', function() {
  15. let wrapper = shallow(<IdBadge project={TestStubs.Project()} />, routerContext);
  16. expect(wrapper.find('ProjectBadge')).toHaveLength(1);
  17. });
  18. it('renders the correct component when `organization` property is passed', function() {
  19. let wrapper = shallow(
  20. <IdBadge organization={TestStubs.Organization()} />,
  21. routerContext
  22. );
  23. expect(wrapper.find('OrganizationBadgeContainer')).toHaveLength(1);
  24. });
  25. it('throws when no valid properties are passed', function() {
  26. expect(() => shallow(<IdBadge />, routerContext)).toThrow();
  27. });
  28. });