index.spec.jsx 1.2 KB

123456789101112131415161718192021222324252627282930313233
  1. import {mountWithTheme} from 'sentry-test/enzyme';
  2. import IdBadge from 'sentry/components/idBadge';
  3. describe('IdBadge', function () {
  4. it('renders the correct component when `user` property is passed', function () {
  5. const wrapper = mountWithTheme(<IdBadge user={TestStubs.User()} />);
  6. expect(wrapper.find('UserBadge')).toHaveLength(1);
  7. });
  8. it('renders the correct component when `team` property is passed', function () {
  9. const wrapper = mountWithTheme(<IdBadge team={TestStubs.Team()} />);
  10. expect(wrapper.find('[data-test-id="team-badge"]')).toHaveLength(1);
  11. });
  12. it('renders the correct component when `project` property is passed', function () {
  13. const wrapper = mountWithTheme(<IdBadge project={TestStubs.Project()} />);
  14. expect(wrapper.find('ProjectBadge')).toHaveLength(1);
  15. });
  16. it('renders the correct component when `organization` property is passed', function () {
  17. const wrapper = mountWithTheme(<IdBadge organization={TestStubs.Organization()} />);
  18. expect(wrapper.find('OrganizationBadge')).toHaveLength(1);
  19. });
  20. it('throws when no valid properties are passed', function () {
  21. expect(() => mountWithTheme(<IdBadge />)).toThrow();
  22. });
  23. });