baseBadge.spec.jsx 1.0 KB

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