diff --git a/public/app/features/explore/TableContainer.test.tsx b/public/app/features/explore/TableContainer.test.tsx new file mode 100644 index 00000000000..1f79150435c --- /dev/null +++ b/public/app/features/explore/TableContainer.test.tsx @@ -0,0 +1,42 @@ +import React from 'react'; +import { shallow, render } from 'enzyme'; +import { TableContainer } from './TableContainer'; +import { DataFrame } from '@grafana/data'; +import { toggleTable } from './state/actions'; +import { ExploreId } from 'app/types/explore'; + +describe('TableContainer', () => { + it('should render component', () => { + const props = { + exploreId: ExploreId.left as ExploreId, + loading: false, + width: 800, + onClickCell: jest.fn(), + showingTable: true, + tableResult: {} as DataFrame, + toggleTable: {} as typeof toggleTable, + }; + + const wrapper = shallow(); + expect(wrapper).toMatchSnapshot(); + }); + + it('should render 0 series returned on no items', () => { + const props = { + exploreId: ExploreId.left as ExploreId, + loading: false, + width: 800, + onClickCell: jest.fn(), + showingTable: true, + tableResult: { + name: 'TableResultName', + fields: [], + length: 0, + } as DataFrame, + toggleTable: {} as typeof toggleTable, + }; + + const wrapper = render(); + expect(wrapper.find('0 series returned')).toBeTruthy(); + }); +}); diff --git a/public/app/features/explore/__snapshots__/TableContainer.test.tsx.snap b/public/app/features/explore/__snapshots__/TableContainer.test.tsx.snap new file mode 100644 index 00000000000..6ca3336eec6 --- /dev/null +++ b/public/app/features/explore/__snapshots__/TableContainer.test.tsx.snap @@ -0,0 +1,21 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`TableContainer should render component 1`] = ` + + + +`;