2020-01-26 22:27:09 -06:00
|
|
|
import React from 'react';
|
2020-06-10 00:09:02 -05:00
|
|
|
import { render, shallow } from 'enzyme';
|
2020-01-26 22:27:09 -06:00
|
|
|
import { TableContainer } from './TableContainer';
|
|
|
|
import { DataFrame } from '@grafana/data';
|
|
|
|
import { ExploreId } from 'app/types/explore';
|
|
|
|
|
|
|
|
describe('TableContainer', () => {
|
|
|
|
it('should render component', () => {
|
|
|
|
const props = {
|
|
|
|
exploreId: ExploreId.left as ExploreId,
|
|
|
|
loading: false,
|
|
|
|
width: 800,
|
2020-06-10 00:09:02 -05:00
|
|
|
onCellFilterAdded: jest.fn(),
|
2020-01-26 22:27:09 -06:00
|
|
|
tableResult: {} as DataFrame,
|
2020-06-30 07:51:04 -05:00
|
|
|
splitOpen: (() => {}) as any,
|
|
|
|
range: {} as any,
|
2020-01-26 22:27:09 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
const wrapper = shallow(<TableContainer {...props} />);
|
|
|
|
expect(wrapper).toMatchSnapshot();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should render 0 series returned on no items', () => {
|
|
|
|
const props = {
|
|
|
|
exploreId: ExploreId.left as ExploreId,
|
|
|
|
loading: false,
|
|
|
|
width: 800,
|
2020-06-10 00:09:02 -05:00
|
|
|
onCellFilterAdded: jest.fn(),
|
2020-01-26 22:27:09 -06:00
|
|
|
tableResult: {
|
|
|
|
name: 'TableResultName',
|
|
|
|
fields: [],
|
|
|
|
length: 0,
|
|
|
|
} as DataFrame,
|
2020-06-30 07:51:04 -05:00
|
|
|
splitOpen: (() => {}) as any,
|
|
|
|
range: {} as any,
|
2020-01-26 22:27:09 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
const wrapper = render(<TableContainer {...props} />);
|
|
|
|
expect(wrapper.find('0 series returned')).toBeTruthy();
|
|
|
|
});
|
|
|
|
});
|