11import userEvents from '@testing-library/user-event' ;
2- import { waitFor , act } from '@testing-library/react' ;
2+ import { waitFor } from '@testing-library/react' ;
33
44import { renderWithForm } from '../../../test/index' ;
55import { Submit } from '../../actions/index' ;
@@ -26,10 +26,8 @@ describe('<SubmitError />', () => {
2626 const submit = getByRole ( 'button' ) ;
2727 const input = getByRole ( 'textbox' ) ;
2828
29- await act ( async ( ) => {
30- await userEvents . type ( input , 'test' ) ;
31- await userEvents . click ( submit ) ;
32- } ) ;
29+ await userEvents . type ( input , 'test' ) ;
30+ await userEvents . click ( submit ) ;
3331
3432 await waitFor ( ( ) => {
3533 // onSubmitFailed callback should only be called if onSubmit callback is called and failed
@@ -63,10 +61,8 @@ describe('<SubmitError />', () => {
6361 const submit = getByRole ( 'button' ) ;
6462 const input = getByRole ( 'textbox' ) ;
6563
66- await act ( async ( ) => {
67- await userEvents . type ( input , 'test' ) ;
68- await userEvents . click ( submit ) ;
69- } ) ;
64+ await userEvents . type ( input , 'test' ) ;
65+ await userEvents . click ( submit ) ;
7066
7167 await waitFor ( ( ) => {
7268 // onSubmitFailed callback should only be called if onSubmit callback is called and failed
@@ -84,7 +80,7 @@ describe('<SubmitError />', () => {
8480 expect ( submitErrorElement ) . toBeInTheDocument ( ) ;
8581 } ) ;
8682
87- await act ( ( ) => userEvents . type ( input , 'changed' ) ) ;
83+ await userEvents . type ( input , 'changed' ) ;
8884
8985 await waitFor ( ( ) => {
9086 expect ( submitErrorElement ) . not . toBeInTheDocument ( ) ;
@@ -111,10 +107,8 @@ describe('<SubmitError />', () => {
111107 const submit = getByRole ( 'button' ) ;
112108 const input = getByRole ( 'textbox' ) ;
113109
114- await act ( async ( ) => {
115- await userEvents . type ( input , 'test' ) ;
116- await userEvents . click ( submit ) ;
117- } ) ;
110+ await userEvents . type ( input , 'test' ) ;
111+ await userEvents . click ( submit ) ;
118112
119113 await waitFor ( ( ) => {
120114 // onSubmitFailed callback should only be called if onSubmit callback is called and failed
0 commit comments