baseBadge.spec.jsx 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. import {mountWithTheme} from 'sentry-test/enzyme';
  2. import BaseBadge from 'app/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. TestStubs.routerContext()
  11. );
  12. expect(wrapper.find('#test')).toHaveLength(1);
  13. expect(wrapper.find('#test').text()).toBe('display name');
  14. });
  15. it('can hide avatar', function () {
  16. const wrapper = mountWithTheme(
  17. <BaseBadge organization={TestStubs.Organization()} hideAvatar />,
  18. TestStubs.routerContext()
  19. );
  20. expect(wrapper.find('StyledAvatar')).toHaveLength(0);
  21. });
  22. it('can hide name', function () {
  23. const wrapper = mountWithTheme(
  24. <BaseBadge
  25. organization={TestStubs.Organization()}
  26. hideName
  27. displayName={<span id="test">display name</span>}
  28. />,
  29. TestStubs.routerContext()
  30. );
  31. expect(wrapper.find('#test')).toHaveLength(0);
  32. });
  33. });