2018-10-17 09:14:45 -05:00
|
|
|
import React from 'react';
|
|
|
|
import { shallow } from 'enzyme';
|
|
|
|
import { DataSourceDashboards, Props } from './DataSourceDashboards';
|
2021-02-11 06:45:25 -06:00
|
|
|
import { DataSourceSettings, NavModel } from '@grafana/data';
|
2019-04-30 09:46:46 -05:00
|
|
|
import { PluginDashboard } from 'app/types';
|
2018-10-17 09:14:45 -05:00
|
|
|
|
|
|
|
const setup = (propOverrides?: object) => {
|
|
|
|
const props: Props = {
|
|
|
|
navModel: {} as NavModel,
|
|
|
|
dashboards: [] as PluginDashboard[],
|
2019-01-17 11:51:07 -06:00
|
|
|
dataSource: {} as DataSourceSettings,
|
2018-10-17 09:14:45 -05:00
|
|
|
pageId: 1,
|
|
|
|
importDashboard: jest.fn(),
|
|
|
|
loadDataSource: jest.fn(),
|
|
|
|
loadPluginDashboards: jest.fn(),
|
|
|
|
removeDashboard: jest.fn(),
|
2019-02-13 04:14:53 -06:00
|
|
|
isLoading: false,
|
2018-10-17 09:14:45 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
Object.assign(props, propOverrides);
|
|
|
|
|
|
|
|
return shallow(<DataSourceDashboards {...props} />);
|
|
|
|
};
|
|
|
|
|
|
|
|
describe('Render', () => {
|
|
|
|
it('should render component', () => {
|
|
|
|
const wrapper = setup();
|
|
|
|
|
|
|
|
expect(wrapper).toMatchSnapshot();
|
|
|
|
});
|
|
|
|
});
|