Files
grafana/public/app/features/datasources/components/ButtonRow.test.tsx
Ashley Harrison 4e492ae725 Navigation: Unify Page component (#66951)
* remove old page component

* add test to check initDashboard is only called once (prevent variables loading twice)

* add help node

* update unit tests

* remove last mentions of topnav

* fix unit tests

* remove unused props from ButtonRow interface

* remove prop from test
2023-04-24 16:41:32 +01:00

33 lines
809 B
TypeScript

import { screen, render } from '@testing-library/react';
import React from 'react';
import { selectors } from '@grafana/e2e-selectors';
import { ButtonRow, Props } from './ButtonRow';
const setup = (propOverrides?: object) => {
const props: Props = {
canSave: false,
onSubmit: jest.fn(),
onTest: jest.fn(),
exploreUrl: '/explore',
};
Object.assign(props, propOverrides);
return render(<ButtonRow {...props} />);
};
describe('<ButtonRow>', () => {
it('should render component', () => {
setup();
expect(screen.getByRole('link', { name: 'Explore' })).toBeInTheDocument();
});
it('should render save & test', () => {
setup({ canSave: true });
expect(screen.getByRole('button', { name: selectors.pages.DataSource.saveAndTest })).toBeInTheDocument();
});
});