mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Co-authored-by: Ivan Ortega <ivanortegaalba@gmail.com> Co-authored-by: Josh Hunt <joshhunt@users.noreply.github.com> Co-authored-by: Dominik Prokop <dominik.prokop@grafana.com> Co-authored-by: polinaboneva <polina.boneva@grafana.com>
33 lines
1.0 KiB
TypeScript
33 lines
1.0 KiB
TypeScript
import { render, screen } from '@testing-library/react';
|
|
import React from 'react';
|
|
|
|
import { PanelModel } from '../../state';
|
|
import { createDashboardModelFixture } from '../../state/__fixtures__/dashboardFixtures';
|
|
|
|
import { AddPanelWidgetUnconnected as AddPanelWidget, Props } from './AddPanelWidget';
|
|
|
|
const getTestContext = (propOverrides?: object) => {
|
|
const props: Props = {
|
|
dashboard: createDashboardModelFixture(),
|
|
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();
|
|
});
|
|
});
|