TanStackT
TanStack3y ago
2 replies
skinny-azure

How to mock refetch in jest with typescript

Hello! I have a custom hook that calls useQuery and exports its refetch property. How could I mock this in jest? its definition is <TPageData>(options?: RefetchOptions & RefetchQueryFilters<TPageData>) => Promise<QueryObserverResult<TData, TError>> , which means the return type itself has a refetch so not sure how to handle the recursion.
Was this page helpful?