grafana/public/app/features/explore/TableContainer.test.tsx
Ivana Huckova f6c91d1318
Explore: Remove not running query for collapsed elements (#27026)
* Make graph and table collapsing just a UI thing

* Remove showingGraph and showingTable, set them defaultly to true

* Remove collaapsing for panels in Explore

* UI toggle WiP

* WIP, add query type

* Refactor, clean up

* Update tests

* Clean uo

* Update rangeAll to range and instant

* Remove console logs

* Update packages/grafana-data/src/types/datasource.ts

Co-authored-by: Zoltán Bedi <zoltan.bedi@gmail.com>

* Update public/app/core/utils/explore.ts

Co-authored-by: Zoltán Bedi <zoltan.bedi@gmail.com>

* Fix prettier error

Co-authored-by: Zoltán Bedi <zoltan.bedi@gmail.com>
2020-09-22 17:31:42 +02:00

42 lines
1.1 KiB
TypeScript

import React from 'react';
import { render, shallow } from 'enzyme';
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,
onCellFilterAdded: jest.fn(),
tableResult: {} as DataFrame,
splitOpen: (() => {}) as any,
range: {} as any,
};
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,
onCellFilterAdded: jest.fn(),
tableResult: {
name: 'TableResultName',
fields: [],
length: 0,
} as DataFrame,
splitOpen: (() => {}) as any,
range: {} as any,
};
const wrapper = render(<TableContainer {...props} />);
expect(wrapper.find('0 series returned')).toBeTruthy();
});
});