queryCount.spec.tsx 997 B

1234567891011121314151617181920212223242526272829
  1. import {render} from 'sentry-test/reactTestingLibrary';
  2. import QueryCount from 'sentry/components/queryCount';
  3. describe('QueryCount', function () {
  4. it('displays count when no max', function () {
  5. const {container} = render(<QueryCount count={5} />);
  6. expect(container).toSnapshot();
  7. });
  8. it('displays count when count < max', function () {
  9. const {container} = render(<QueryCount count={5} max={500} />);
  10. expect(container).toSnapshot();
  11. });
  12. it('does not render if count is 0', function () {
  13. const {container} = render(<QueryCount count={0} />);
  14. expect(container).toBeEmptyDOMElement();
  15. });
  16. it('can render when count is 0 when `hideIfEmpty` is false', function () {
  17. const {container} = render(<QueryCount count={0} hideIfEmpty={false} />);
  18. expect(container).toSnapshot();
  19. });
  20. it('displays max count if count >= max', function () {
  21. const {container} = render(<QueryCount count={500} max={500} />);
  22. expect(container).toSnapshot();
  23. });
  24. });