@@ -26,8 +26,10 @@ describe('<SubmitError />', () => {
2626 const submit = getByRole ( 'button' ) ;
2727 const input = getByRole ( 'textbox' ) ;
2828
29- await userEvents . type ( input , 'test' ) ;
30- await userEvents . click ( submit ) ;
29+ await act ( async ( ) => {
30+ await userEvents . type ( input , 'test' ) ;
31+ await userEvents . click ( submit ) ;
32+ } ) ;
3133
3234 await waitFor ( ( ) => {
3335 // onSubmitFailed callback should only be called if onSubmit callback is called and failed
@@ -61,8 +63,10 @@ describe('<SubmitError />', () => {
6163 const submit = getByRole ( 'button' ) ;
6264 const input = getByRole ( 'textbox' ) ;
6365
64- await userEvents . type ( input , 'test' ) ;
65- await userEvents . click ( submit ) ;
66+ await act ( async ( ) => {
67+ await userEvents . type ( input , 'test' ) ;
68+ await userEvents . click ( submit ) ;
69+ } ) ;
6670
6771 await waitFor ( ( ) => {
6872 // onSubmitFailed callback should only be called if onSubmit callback is called and failed
@@ -80,7 +84,7 @@ describe('<SubmitError />', () => {
8084 expect ( submitErrorElement ) . toBeInTheDocument ( ) ;
8185 } ) ;
8286
83- await userEvents . type ( input , 'changed' ) ;
87+ await act ( ( ) => userEvents . type ( input , 'changed' ) ) ;
8488
8589 await waitFor ( ( ) => {
8690 expect ( submitErrorElement ) . not . toBeInTheDocument ( ) ;
@@ -107,8 +111,10 @@ describe('<SubmitError />', () => {
107111 const submit = getByRole ( 'button' ) ;
108112 const input = getByRole ( 'textbox' ) ;
109113
110- await userEvents . type ( input , 'test' ) ;
111- await userEvents . click ( submit ) ;
114+ await act ( async ( ) => {
115+ await userEvents . type ( input , 'test' ) ;
116+ await userEvents . click ( submit ) ;
117+ } ) ;
112118
113119 await waitFor ( ( ) => {
114120 // onSubmitFailed callback should only be called if onSubmit callback is called and failed
0 commit comments