baseBadge.spec.jsx 994 B

12345678910111213141516171819202122232425262728293031323334
  1. import {mountWithTheme} from 'sentry-test/enzyme';
  2. import BaseBadge from 'sentry/components/idBadge/baseBadge';
  3. describe('BadgeBadge', function () {
  4. it('has a display name', function () {
  5. const wrapper = mountWithTheme(
  6. <BaseBadge
  7. organization={TestStubs.Organization()}
  8. displayName={<span id="test">display name</span>}
  9. />
  10. );
  11. expect(wrapper.find('#test')).toHaveLength(1);
  12. expect(wrapper.find('#test').text()).toBe('display name');
  13. });
  14. it('can hide avatar', function () {
  15. const wrapper = mountWithTheme(
  16. <BaseBadge organization={TestStubs.Organization()} hideAvatar />
  17. );
  18. expect(wrapper.find('StyledAvatar')).toHaveLength(0);
  19. });
  20. it('can hide name', function () {
  21. const wrapper = mountWithTheme(
  22. <BaseBadge
  23. organization={TestStubs.Organization()}
  24. hideName
  25. displayName={<span id="test">display name</span>}
  26. />
  27. );
  28. expect(wrapper.find('#test')).toHaveLength(0);
  29. });
  30. });