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,19 +313,20 @@ 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);
render( await act(async () =>
<IntlProvider locale="en"> render(
<AppBar <IntlProvider locale="en">
mapInfo={new MapInfoImpl('welcome', 'Develop Map Title', false)} <AppBar
capability={capacity} mapInfo={new MapInfoImpl('welcome', 'Develop Map Title', false)}
model={model} capability={capacity}
/> model={model}
, />
</IntlProvider>, </IntlProvider>,
),
); );
screen.getByRole('menubar'); screen.getByRole('menubar');
}); });