Merged in bugfix/editor-unit-test (pull request #70)

fix(test): toolbar test log error

* fix(test): toolbar test log error


Approved-by: Paulo Veiga
This commit is contained in:
Clément CREUSAT 2023-06-30 13:08:36 +00:00 committed by Paulo Veiga
parent 9888d7542b
commit 6c41beb45e

View File

@ -2,7 +2,7 @@
* @jest-environment jsdom * @jest-environment jsdom
*/ */
import React from 'react'; import React from 'react';
import { render, fireEvent, waitFor, screen, findByLabelText } from '@testing-library/react'; import { render, fireEvent, waitFor, screen, findByLabelText, act } from '@testing-library/react';
import ThreeDRotation from '@mui/icons-material/ThreeDRotation'; import ThreeDRotation from '@mui/icons-material/ThreeDRotation';
import Toolbar, { import Toolbar, {
ToolbarButtonOption, ToolbarButtonOption,
@ -313,10 +313,11 @@ describe('Toolbar', () => {
}); });
describe('AppBar', () => { describe('AppBar', () => {
it('When render it displays a menu', () => { it('When render it displays a menu', async () => {
const capacity = new Capability('edition-owner', false); const capacity = new Capability('edition-owner', false);
const model = new Editor(null); const model = new Editor(null);
await act(async () =>
render( render(
<IntlProvider locale="en"> <IntlProvider locale="en">
<AppBar <AppBar
@ -324,8 +325,8 @@ describe('AppBar', () => {
capability={capacity} capability={capacity}
model={model} model={model}
/> />
,
</IntlProvider>, </IntlProvider>,
),
); );
screen.getByRole('menubar'); screen.getByRole('menubar');
}); });