mirror of
https://github.com/grafana/grafana.git
synced 2024-11-30 12:44:10 -06:00
Chore: Reduce console output in NavBarItem.test.tsx (#45139)
* Chore: Reduce console ouput in NavBarItem.test.tsx * Chore: remove async
This commit is contained in:
parent
df282a42cb
commit
e4534deab3
@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import { render, screen, waitFor } from '@testing-library/react';
|
||||
import { act, render, screen, waitFor } from '@testing-library/react';
|
||||
import userEvent from '@testing-library/user-event';
|
||||
import { BrowserRouter } from 'react-router-dom';
|
||||
import { locationUtil } from '@grafana/data';
|
||||
@ -53,8 +53,9 @@ describe('NavBarItem', () => {
|
||||
it('then the onClick handler should be called', () => {
|
||||
getTestContext();
|
||||
|
||||
userEvent.click(screen.getByRole('button'));
|
||||
|
||||
act(() => {
|
||||
userEvent.click(screen.getByRole('button'));
|
||||
});
|
||||
expect(onClickMock).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
});
|
||||
@ -194,7 +195,9 @@ describe('NavBarItem', () => {
|
||||
expect(screen.getByText('New')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
userEvent.click(screen.getByText('New'));
|
||||
act(() => {
|
||||
userEvent.click(screen.getByText('New'));
|
||||
});
|
||||
await waitFor(() => {
|
||||
expect(pushMock).toHaveBeenCalledTimes(1);
|
||||
expect(pushMock).toHaveBeenCalledWith('/dashboard/new');
|
||||
@ -218,7 +221,9 @@ describe('NavBarItem', () => {
|
||||
expect(screen.getByText('New')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
userEvent.click(screen.getByText('New'));
|
||||
act(() => {
|
||||
userEvent.click(screen.getByText('New'));
|
||||
});
|
||||
await waitFor(() => {
|
||||
expect(pushMock).toHaveBeenCalledTimes(1);
|
||||
expect(pushMock).toHaveBeenCalledWith('/grafana/dashboard/new');
|
||||
|
Loading…
Reference in New Issue
Block a user