mirror of
https://github.com/grafana/grafana.git
synced 2025-02-15 01:53:33 -06:00
Primarily- moving majority of the types and utils from @grafana/ui to @grafana/data * Move types from grafana-ui to grafana-data * Move valueFormats to grafana-data * Move utils from grafana-ui to grafana-data * Update imports in grafana-ui * revert data's tsconfig change * Update imports in grafana-runtime * Fix import paths in grafana-ui * Move rxjs to devDeps * Core import updates batch 1 * Import updates batch 2 * Imports fix batch 3 * Imports fixes batch i don't know * Fix imorts in grafana-toolkit * Fix imports after master merge
52 lines
1.4 KiB
TypeScript
52 lines
1.4 KiB
TypeScript
import React from 'react';
|
|
import { shallow } from 'enzyme';
|
|
import { DataSourcesListPage, Props } from './DataSourcesListPage';
|
|
import { DataSourceSettings } from '@grafana/data';
|
|
import { NavModel } from '@grafana/data';
|
|
import { LayoutModes } from '../../core/components/LayoutSelector/LayoutSelector';
|
|
import { getMockDataSources } from './__mocks__/dataSourcesMocks';
|
|
import { setDataSourcesSearchQuery, setDataSourcesLayoutMode } from './state/actions';
|
|
|
|
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();
|
|
});
|
|
});
|