File tree Expand file tree Collapse file tree
packages/angular-query-experimental/src/__tests__ Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -412,6 +412,28 @@ describe('injectMutation', () => {
412412 expect ( boundaryFn ) . toHaveBeenCalledTimes ( 1 )
413413 expect ( boundaryFn ) . toHaveBeenCalledWith ( err )
414414 } )
415+
416+ test ( 'should throw when throwOnError is true and mutate is used' , async ( ) => {
417+ const { mutate } = TestBed . runInInjectionContext ( ( ) => {
418+ return injectMutation ( ( ) => ( {
419+ mutationKey : [ 'fake' ] ,
420+ mutationFn : ( ) => {
421+ return Promise . reject (
422+ new Error ( 'Expected mock error. All is well!' ) ,
423+ )
424+ } ,
425+ throwOnError : true ,
426+ } ) )
427+ } )
428+
429+ TestBed . tick ( )
430+
431+ mutate ( )
432+
433+ await expect ( vi . advanceTimersByTimeAsync ( 0 ) ) . rejects . toThrow (
434+ 'Expected mock error. All is well!' ,
435+ )
436+ } )
415437 } )
416438
417439 test ( 'should throw when throwOnError is true' , async ( ) => {
You can’t perform that action at this time.
0 commit comments