baseBadge.spec.tsx 1012 B

12345678910111213141516171819202122232425262728293031323334
  1. import {render, screen} from 'sentry-test/reactTestingLibrary';
  2. import BaseBadge from 'sentry/components/idBadge/baseBadge';
  3. describe('BadgeBadge', function () {
  4. it('has a display name', function () {
  5. render(
  6. <BaseBadge
  7. organization={TestStubs.Organization()}
  8. displayName={<span>display name</span>}
  9. />
  10. );
  11. expect(screen.getByText('display name')).toBeInTheDocument();
  12. });
  13. it('can hide avatar', function () {
  14. render(
  15. <BaseBadge organization={TestStubs.Organization()} displayName="hello" hideAvatar />
  16. );
  17. expect(screen.queryByTestId('badge-styled-avatar')).not.toBeInTheDocument();
  18. expect(screen.getByTestId('badge-display-name')).toHaveTextContent('hello');
  19. });
  20. it('can hide name', function () {
  21. render(
  22. <BaseBadge
  23. organization={TestStubs.Organization()}
  24. hideName
  25. displayName={<span>display name</span>}
  26. />
  27. );
  28. expect(screen.queryByText('display name')).not.toBeInTheDocument();
  29. });
  30. });