score:1

I solved it by placing the mockImplementationOnce directly in this block of code that was outside of it () and removed those that were inside it, leaving only the toHaveBeenNthCalledWith.

jest.mock('@/hooks/useRest', () => {
  return {
    useGet: jest.fn((url) => {
      if (url === 'all-boletos-cash-in') {
        return {
          refetch: mockGetData.mockImplementationOnce(() => [1, 2, 3])
        }
      }
      if (url === 'all-boletos-cash-out') {
        return {
          refetch: mockGetData.mockImplementationOnce(() => [1, 2, 3, 4, 5])
        }
      }
    })
  }
})

Related Query

More Query from same tag