grafana/public/app/features/dashboard/components/AddPanelWidget/AddPanelWidget.test.tsx
Torkel Ödegaard 070344943c
PanelEditor: Present actionable suggestions when panel cannot visualize current data (#42083)
* PanelDataError: Show actions when current panel cannot visualize data

* Fixed so that suggestions tab is opened from action

* Cleanup

* Fixed tests

* Fix tests

* Fixing tests

* Fixed ts issues
2021-11-25 09:41:03 +01:00

30 lines
960 B
TypeScript

import React from 'react';
import { render, screen } from '@testing-library/react';
import { AddPanelWidgetUnconnected as AddPanelWidget, Props } from './AddPanelWidget';
import { DashboardModel, PanelModel } from '../../state';
const getTestContext = (propOverrides?: object) => {
const props: Props = {
dashboard: {} as DashboardModel,
panel: {} as PanelModel,
addPanel: jest.fn() as any,
};
Object.assign(props, propOverrides);
return render(<AddPanelWidget {...props} />);
};
describe('AddPanelWidget', () => {
it('should render component without error', () => {
expect(() => {
getTestContext();
});
});
it('should render the add panel actions', () => {
getTestContext();
expect(screen.getByText(/Add a new panel/i)).toBeInTheDocument();
expect(screen.getByText(/Add a new row/i)).toBeInTheDocument();
expect(screen.getByText(/Add a panel from the panel library/i)).toBeInTheDocument();
});
});