mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore: Converts SaveDashboardAsForm tests to RTL (#49436)
This commit is contained in:
parent
50c2b4682a
commit
71ffa5e5db
@ -146,9 +146,6 @@ exports[`no enzyme tests`] = {
|
||||
"public/app/features/dashboard/components/DashboardRow/DashboardRow.test.tsx:1463123173": [
|
||||
[0, 17, 13, "RegExp match", "2409514259"]
|
||||
],
|
||||
"public/app/features/dashboard/components/SaveDashboard/forms/SaveDashboardAsForm.test.tsx:1969004590": [
|
||||
[0, 17, 13, "RegExp match", "2409514259"]
|
||||
],
|
||||
"public/app/features/dashboard/components/ShareModal/ShareLink.test.tsx:2357087833": [
|
||||
[0, 35, 13, "RegExp match", "2409514259"]
|
||||
],
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { mount } from 'enzyme';
|
||||
import { screen, render } from '@testing-library/react';
|
||||
import userEvent from '@testing-library/user-event';
|
||||
import React from 'react';
|
||||
import { act } from 'react-dom/test-utils';
|
||||
|
||||
import { DashboardModel } from 'app/features/dashboard/state';
|
||||
import * as api from 'app/features/manage-dashboards/state/actions';
|
||||
@ -35,7 +35,7 @@ const renderAndSubmitForm = async (
|
||||
submitSpy: jest.Mock,
|
||||
otherProps: Partial<SaveDashboardAsFormProps> = {}
|
||||
) => {
|
||||
const container = mount(
|
||||
render(
|
||||
<SaveDashboardAsForm
|
||||
dashboard={dashboard as DashboardModel}
|
||||
onCancel={() => {}}
|
||||
@ -48,11 +48,8 @@ const renderAndSubmitForm = async (
|
||||
/>
|
||||
);
|
||||
|
||||
// @ts-ignore strict null error below
|
||||
await act(async () => {
|
||||
const button = container.find('button[aria-label="Save dashboard button"]');
|
||||
button.simulate('submit');
|
||||
});
|
||||
const button = screen.getByRole('button', { name: 'Save dashboard button' });
|
||||
await userEvent.click(button);
|
||||
};
|
||||
describe('SaveDashboardAsForm', () => {
|
||||
describe('default values', () => {
|
||||
|
Loading…
Reference in New Issue
Block a user