@@ -77,7 +77,6 @@ describe('useDelete', () => {
7777 } ) ;
7878
7979 it ( 'uses the latest declaration time mutationMode' , async ( ) => {
80- jest . spyOn ( console , 'log' ) . mockImplementation ( ( ) => { } ) ;
8180 // This story uses the pessimistic mode by default
8281 render ( < MutationMode /> ) ;
8382 await waitFor ( ( ) => new Promise ( resolve => setTimeout ( resolve , 0 ) ) ) ;
@@ -99,21 +98,18 @@ describe('useDelete', () => {
9998 } ) ;
10099
101100 it ( 'uses the latest declaration time params' , async ( ) => {
102- jest . spyOn ( console , 'log' ) . mockImplementation ( ( ) => { } ) ;
103101 const posts = [
104102 { id : 1 , title : 'Hello' } ,
105103 { id : 2 , title : 'World' } ,
106104 ] ;
107105 const dataProvider = {
108- getList : ( resource , params ) => {
109- console . log ( 'getList' , resource , params ) ;
106+ getList : ( ) => {
110107 return Promise . resolve ( {
111108 data : posts ,
112109 total : posts . length ,
113110 } ) ;
114111 } ,
115- delete : jest . fn ( ( resource , params ) => {
116- console . log ( 'delete' , resource , params ) ;
112+ delete : jest . fn ( ( _ , params ) => {
117113 return new Promise ( resolve => {
118114 setTimeout ( ( ) => {
119115 const index = posts . findIndex ( p => p . id === params . id ) ;
@@ -384,7 +380,6 @@ describe('useDelete', () => {
384380
385381 describe ( 'mutationMode' , ( ) => {
386382 it ( 'when pessimistic, displays result and success side effects when dataProvider promise resolves' , async ( ) => {
387- jest . spyOn ( console , 'log' ) . mockImplementation ( ( ) => { } ) ;
388383 render ( < SuccessCasePessimistic /> ) ;
389384 screen . getByText ( 'Delete first post' ) . click ( ) ;
390385 await waitFor ( ( ) => {
@@ -401,7 +396,6 @@ describe('useDelete', () => {
401396 expect ( screen . queryByText ( 'World' ) ) . not . toBeNull ( ) ;
402397 } ) ;
403398 it ( 'when pessimistic, displays error and error side effects when dataProvider promise rejects' , async ( ) => {
404- jest . spyOn ( console , 'log' ) . mockImplementation ( ( ) => { } ) ;
405399 jest . spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } ) ;
406400 render ( < ErrorCasePessimistic /> ) ;
407401 screen . getByText ( 'Delete first post' ) . click ( ) ;
@@ -450,7 +444,6 @@ describe('useDelete', () => {
450444 ) . not . toBeNull ( ) ;
451445 } ) ;
452446 it ( 'when optimistic, displays result and success side effects right away' , async ( ) => {
453- jest . spyOn ( console , 'log' ) . mockImplementation ( ( ) => { } ) ;
454447 render ( < SuccessCaseOptimistic /> ) ;
455448 await waitFor ( ( ) => new Promise ( resolve => setTimeout ( resolve , 0 ) ) ) ;
456449 screen . getByText ( 'Delete first post' ) . click ( ) ;
@@ -468,7 +461,6 @@ describe('useDelete', () => {
468461 } ) ;
469462 } ) ;
470463 it ( 'when optimistic, displays error and error side effects when dataProvider promise rejects' , async ( ) => {
471- jest . spyOn ( console , 'log' ) . mockImplementation ( ( ) => { } ) ;
472464 jest . spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } ) ;
473465 render ( < ErrorCaseOptimistic /> ) ;
474466 await waitFor ( ( ) => new Promise ( resolve => setTimeout ( resolve , 0 ) ) ) ;
@@ -490,7 +482,6 @@ describe('useDelete', () => {
490482 } ) ;
491483 } ) ;
492484 it ( 'when undoable, displays result and success side effects right away and fetched on confirm' , async ( ) => {
493- jest . spyOn ( console , 'log' ) . mockImplementation ( ( ) => { } ) ;
494485 render ( < SuccessCaseUndoable /> ) ;
495486 await waitFor ( ( ) => new Promise ( resolve => setTimeout ( resolve , 0 ) ) ) ;
496487 screen . getByText ( 'Delete first post' ) . click ( ) ;
@@ -518,7 +509,6 @@ describe('useDelete', () => {
518509 ) ;
519510 } ) ;
520511 it ( 'when undoable, displays result and success side effects right away and reverts on cancel' , async ( ) => {
521- jest . spyOn ( console , 'log' ) . mockImplementation ( ( ) => { } ) ;
522512 render ( < SuccessCaseUndoable /> ) ;
523513 await waitFor ( ( ) => new Promise ( resolve => setTimeout ( resolve , 0 ) ) ) ;
524514 screen . getByText ( 'Delete first post' ) . click ( ) ;
@@ -536,7 +526,6 @@ describe('useDelete', () => {
536526 } ) ;
537527 } ) ;
538528 it ( 'when undoable, displays result and success side effects right away and reverts on error' , async ( ) => {
539- jest . spyOn ( console , 'log' ) . mockImplementation ( ( ) => { } ) ;
540529 jest . spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } ) ;
541530 render ( < ErrorCaseUndoable /> ) ;
542531 await waitFor ( ( ) => new Promise ( resolve => setTimeout ( resolve , 0 ) ) ) ;
0 commit comments