queryCount.spec.js 981 B

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