DataSourceDashboards.test.tsx 967 B

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