diff --git a/src/components/Splash/SplashScreenError.spec.tsx b/src/components/Splash/SplashScreenError.spec.tsx index 2f3837093ea572132a209200d5be30813769565e..4f44a4380beb5805ea68519d93de19f16747277b 100644 --- a/src/components/Splash/SplashScreenError.spec.tsx +++ b/src/components/Splash/SplashScreenError.spec.tsx @@ -1,4 +1,5 @@ -import Button from '@material-ui/core/Button' +import { render, screen } from '@testing-library/react' +import { userEvent } from '@testing-library/user-event' import { mount } from 'enzyme' import toJson from 'enzyme-to-json' import { InitStepsErrors } from 'models/initialisationSteps.model' @@ -23,11 +24,9 @@ describe('SplashScreenError component', () => { ) expect(toJson(component)).toMatchSnapshot() }) - it('should reload the page', () => { - const component = mount( - <SplashScreenError error={InitStepsErrors.CONSENT_ERROR} /> - ) - component.find(Button).first().simulate('click') + it('should reload the page', async () => { + render(<SplashScreenError error={InitStepsErrors.CONSENT_ERROR} />) + await userEvent.click(screen.getByRole('button')) expect(window.location.reload).toHaveBeenCalled() }) })