2019-08-30 08:30:24 -05:00
|
|
|
import React from 'react';
|
|
|
|
import { shallow } from 'enzyme';
|
|
|
|
|
2019-09-25 04:19:17 -05:00
|
|
|
import { LoadingState, TimeRange } from '@grafana/data';
|
2019-08-30 08:30:24 -05:00
|
|
|
import { PanelData } from '@grafana/ui';
|
|
|
|
|
|
|
|
import QueryStatus from './QueryStatus';
|
|
|
|
|
|
|
|
describe('<QueryStatus />', () => {
|
|
|
|
it('should render with a latency', () => {
|
2019-09-25 04:19:17 -05:00
|
|
|
const res: PanelData = { series: [], state: LoadingState.Done, timeRange: {} as TimeRange };
|
2019-08-30 08:30:24 -05:00
|
|
|
const wrapper = shallow(<QueryStatus latency={0} queryResponse={res} />);
|
|
|
|
expect(wrapper.find('div').exists()).toBeTruthy();
|
|
|
|
});
|
|
|
|
it('should not render when query has not started', () => {
|
2019-09-25 04:19:17 -05:00
|
|
|
const res: PanelData = { series: [], state: LoadingState.NotStarted, timeRange: {} as TimeRange };
|
2019-08-30 08:30:24 -05:00
|
|
|
const wrapper = shallow(<QueryStatus latency={0} queryResponse={res} />);
|
|
|
|
expect(wrapper.getElement()).toBe(null);
|
|
|
|
});
|
|
|
|
});
|