File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -805,6 +805,8 @@ describe('query', () => {
805
805
} )
806
806
807
807
test ( 'fetch should dispatch an error if the queryFn returns undefined' , async ( ) => {
808
+ const consoleMock = mockConsoleError ( )
809
+
808
810
const key = queryKey ( )
809
811
810
812
const observer = new QueryObserver ( queryClient , {
@@ -821,12 +823,16 @@ describe('query', () => {
821
823
822
824
await sleep ( 10 )
823
825
826
+ const error = new Error ( 'Query data cannot be undefined' )
827
+
824
828
expect ( observerResult ) . toMatchObject ( {
825
829
isError : true ,
826
- error : new Error ( 'Query data cannot be undefined' ) ,
830
+ error,
827
831
} )
828
832
833
+ expect ( consoleMock ) . toHaveBeenCalledWith ( error )
829
834
unsubscribe ( )
835
+ consoleMock . mockRestore ( )
830
836
} )
831
837
832
838
test ( 'fetch should dispatch fetch if is fetching and current promise is undefined' , async ( ) => {
You can’t perform that action at this time.
0 commit comments