File tree Expand file tree Collapse file tree
packages/jest-mock/src/__tests__ Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -422,7 +422,9 @@ describe('moduleMocker', () => {
422422
423423 expect ( promise ) . toBeInstanceOf ( Promise ) ;
424424
425- return promise . catch ( rejection => expect ( rejection ) . toBe ( err ) ) ;
425+ return promise
426+ . then ( ( ) => Promise . reject ( new Error ( 'did not reject' ) ) )
427+ . catch ( rejection => expect ( rejection ) . toBe ( err ) ) ;
426428 } ) ;
427429
428430 it ( 'supports mocking rejectable async functions only once' , ( ) => {
@@ -432,10 +434,12 @@ describe('moduleMocker', () => {
432434 fn . mockRejectedValue ( defaultErr ) ;
433435 fn . mockRejectedValueOnce ( err ) ;
434436
435- const promise1 = fn ( ) . catch ( rejection => expect ( rejection ) . toBe ( err ) ) ;
436- const promise2 = fn ( ) . catch ( rejection =>
437- expect ( rejection ) . toBe ( defaultErr ) ,
438- ) ;
437+ const promise1 = fn ( )
438+ . then ( ( ) => Promise . reject ( new Error ( 'did not reject' ) ) )
439+ . catch ( rejection => expect ( rejection ) . toBe ( err ) ) ;
440+ const promise2 = fn ( )
441+ . then ( ( ) => Promise . reject ( new Error ( 'did not reject' ) ) )
442+ . catch ( rejection => expect ( rejection ) . toBe ( defaultErr ) ) ;
439443
440444 return Promise . all ( [ promise1 , promise2 ] ) ;
441445 } ) ;
You can’t perform that action at this time.
0 commit comments