mirror of
https://github.com/grafana/grafana.git
synced 2024-12-02 05:29:42 -06:00
438b403acc
* Card: migrates styles from sass to emotion * removed LayoutSelector component since it's not used in the codebase * updates card styles with new color name
51 lines
1.3 KiB
TypeScript
51 lines
1.3 KiB
TypeScript
import React from 'react';
|
|
import { shallow } from 'enzyme';
|
|
import { DataSourceSettings, NavModel, LayoutModes } from '@grafana/data';
|
|
|
|
import { DataSourcesListPage, Props } from './DataSourcesListPage';
|
|
import { getMockDataSources } from './__mocks__/dataSourcesMocks';
|
|
import { setDataSourcesLayoutMode, setDataSourcesSearchQuery } from './state/reducers';
|
|
|
|
const setup = (propOverrides?: object) => {
|
|
const props: Props = {
|
|
dataSources: [] as DataSourceSettings[],
|
|
layoutMode: LayoutModes.Grid,
|
|
loadDataSources: jest.fn(),
|
|
navModel: {
|
|
main: {
|
|
text: 'Configuration',
|
|
},
|
|
node: {
|
|
text: 'Data Sources',
|
|
},
|
|
} as NavModel,
|
|
dataSourcesCount: 0,
|
|
searchQuery: '',
|
|
setDataSourcesSearchQuery,
|
|
setDataSourcesLayoutMode,
|
|
hasFetched: false,
|
|
};
|
|
|
|
Object.assign(props, propOverrides);
|
|
|
|
return shallow(<DataSourcesListPage {...props} />);
|
|
};
|
|
|
|
describe('Render', () => {
|
|
it('should render component', () => {
|
|
const wrapper = setup();
|
|
|
|
expect(wrapper).toMatchSnapshot();
|
|
});
|
|
|
|
it('should render action bar and datasources', () => {
|
|
const wrapper = setup({
|
|
dataSources: getMockDataSources(5),
|
|
dataSourcesCount: 5,
|
|
hasFetched: true,
|
|
});
|
|
|
|
expect(wrapper).toMatchSnapshot();
|
|
});
|
|
});
|