grafana/public/app/features/dashboard/components/AddPanelWidget/AddPanelWidget.test.tsx
Ashley Harrison 2a6b32598d
Chore: some low-hanging type assertion fruit (#51618)
* some low-hanging type assertion fruit

* results
2022-06-30 10:40:00 +01:00

32 lines
966 B
TypeScript

import { render, screen } from '@testing-library/react';
import React from 'react';
import { DashboardModel, PanelModel } from '../../state';
import { AddPanelWidgetUnconnected as AddPanelWidget, Props } from './AddPanelWidget';
const getTestContext = (propOverrides?: object) => {
const props: Props = {
dashboard: new DashboardModel({}),
panel: new 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();
});
});