QueryStatus.test.tsx 750 B

1234567891011121314151617181920
  1. import React from 'react';
  2. import { shallow } from 'enzyme';
  3. import { LoadingState } from '@grafana/data';
  4. import { PanelData } from '@grafana/ui';
  5. import QueryStatus from './QueryStatus';
  6. describe('<QueryStatus />', () => {
  7. it('should render with a latency', () => {
  8. const res: PanelData = { series: [], state: LoadingState.Done };
  9. const wrapper = shallow(<QueryStatus latency={0} queryResponse={res} />);
  10. expect(wrapper.find('div').exists()).toBeTruthy();
  11. });
  12. it('should not render when query has not started', () => {
  13. const res: PanelData = { series: [], state: LoadingState.NotStarted };
  14. const wrapper = shallow(<QueryStatus latency={0} queryResponse={res} />);
  15. expect(wrapper.getElement()).toBe(null);
  16. });
  17. });