@@ -303,6 +303,7 @@ describe('useUpdate', () => {
303303 } ) ;
304304 it ( 'when optimistic, displays result and success side effects right away' , async ( ) => {
305305 render ( < SuccessCaseOptimistic timeout = { 10 } /> ) ;
306+ await screen . findByText ( 'Hello' ) ;
306307 screen . getByText ( 'Update title' ) . click ( ) ;
307308 await waitFor ( ( ) => {
308309 expect ( screen . queryByText ( 'success' ) ) . not . toBeNull ( ) ;
@@ -318,6 +319,7 @@ describe('useUpdate', () => {
318319 it ( 'when optimistic, displays error and error side effects when dataProvider promise rejects' , async ( ) => {
319320 jest . spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } ) ;
320321 render ( < ErrorCaseOptimistic timeout = { 10 } /> ) ;
322+ await screen . findByText ( 'Hello' ) ;
321323 screen . getByText ( 'Update title' ) . click ( ) ;
322324 await waitFor ( ( ) => {
323325 expect ( screen . queryByText ( 'success' ) ) . not . toBeNull ( ) ;
@@ -342,6 +344,7 @@ describe('useUpdate', () => {
342344 } ) ;
343345 it ( 'when undoable, displays result and success side effects right away and fetched on confirm' , async ( ) => {
344346 render ( < SuccessCaseUndoable timeout = { 10 } /> ) ;
347+ await screen . findByText ( 'Hello' ) ;
345348 act ( ( ) => {
346349 screen . getByText ( 'Update title' ) . click ( ) ;
347350 } ) ;
@@ -923,6 +926,7 @@ describe('useUpdate', () => {
923926 describe ( 'middlewares' , ( ) => {
924927 it ( 'when pessimistic, it accepts middlewares and displays result and success side effects when dataProvider promise resolves' , async ( ) => {
925928 render ( < WithMiddlewaresSuccessPessimistic timeout = { 10 } /> ) ;
929+ await screen . findByText ( 'Hello' ) ;
926930 screen . getByText ( 'Update title' ) . click ( ) ;
927931 await waitFor ( ( ) => {
928932 expect ( screen . queryByText ( 'success' ) ) . toBeNull ( ) ;
@@ -943,6 +947,7 @@ describe('useUpdate', () => {
943947 it ( 'when pessimistic, it accepts middlewares and displays error and error side effects when dataProvider promise rejects' , async ( ) => {
944948 jest . spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } ) ;
945949 render ( < WithMiddlewaresErrorPessimistic timeout = { 10 } /> ) ;
950+ await screen . findByText ( 'Hello' ) ;
946951 screen . getByText ( 'Update title' ) . click ( ) ;
947952 await waitFor ( ( ) => {
948953 expect ( screen . queryByText ( 'success' ) ) . toBeNull ( ) ;
@@ -966,6 +971,7 @@ describe('useUpdate', () => {
966971
967972 it ( 'when optimistic, it accepts middlewares and displays result and success side effects right away' , async ( ) => {
968973 render ( < WithMiddlewaresSuccessOptimistic timeout = { 10 } /> ) ;
974+ await screen . findByText ( 'Hello' ) ;
969975 screen . getByText ( 'Update title' ) . click ( ) ;
970976 await waitFor ( ( ) => {
971977 expect ( screen . queryByText ( 'success' ) ) . not . toBeNull ( ) ;
@@ -984,6 +990,7 @@ describe('useUpdate', () => {
984990 it ( 'when optimistic, it accepts middlewares and displays error and error side effects when dataProvider promise rejects' , async ( ) => {
985991 jest . spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } ) ;
986992 render ( < WithMiddlewaresErrorOptimistic timeout = { 10 } /> ) ;
993+ await screen . findByText ( 'Hello' ) ;
987994 screen . getByText ( 'Update title' ) . click ( ) ;
988995 await waitFor ( ( ) => {
989996 expect ( screen . queryByText ( 'success' ) ) . not . toBeNull ( ) ;
@@ -1005,6 +1012,7 @@ describe('useUpdate', () => {
10051012
10061013 it ( 'when undoable, it accepts middlewares and displays result and success side effects right away and fetched on confirm' , async ( ) => {
10071014 render ( < WithMiddlewaresSuccessUndoable timeout = { 10 } /> ) ;
1015+ await screen . findByText ( 'Hello' ) ;
10081016 act ( ( ) => {
10091017 screen . getByText ( 'Update title' ) . click ( ) ;
10101018 } ) ;
0 commit comments