DataSourceDashboards.test.tsx 849 B

12345678910111213141516171819202122232425262728293031
  1. import React from 'react';
  2. import { shallow } from 'enzyme';
  3. import { DataSourceDashboards, Props } from './DataSourceDashboards';
  4. import { DataSourceSettings } from '@grafana/ui/src/types';
  5. import { NavModel, PluginDashboard } from 'app/types';
  6. const setup = (propOverrides?: object) => {
  7. const props: Props = {
  8. navModel: {} as NavModel,
  9. dashboards: [] as PluginDashboard[],
  10. dataSource: {} as DataSourceSettings,
  11. pageId: 1,
  12. importDashboard: jest.fn(),
  13. loadDataSource: jest.fn(),
  14. loadPluginDashboards: jest.fn(),
  15. removeDashboard: jest.fn(),
  16. isLoading: false,
  17. };
  18. Object.assign(props, propOverrides);
  19. return shallow(<DataSourceDashboards {...props} />);
  20. };
  21. describe('Render', () => {
  22. it('should render component', () => {
  23. const wrapper = setup();
  24. expect(wrapper).toMatchSnapshot();
  25. });
  26. });