Skip to content

Commit

Permalink
Merge remote-tracking branch 'react-query/v4' into 2927-offline-queries
Browse files Browse the repository at this point in the history
  • Loading branch information
TkDodo committed Nov 26, 2021
2 parents 9c7633d + b12bc2c commit d8d893f
Showing 1 changed file with 0 additions and 28 deletions.
28 changes: 0 additions & 28 deletions src/core/tests/queriesObserver.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,34 +55,6 @@ describe('queriesObserver', () => {
expect(observerResult).toMatchObject([{ data: 1 }, { data: 2 }])
})

test('should return same value for multiple falsy query keys', async () => {
const queryFn1 = jest.fn().mockReturnValue(1)
const queryFn2 = jest.fn().mockReturnValue(2)
const observer = new QueriesObserver(queryClient, [
{ queryKey: undefined, queryFn: queryFn1 },
])
const results: QueryObserverResult[][] = []
results.push(observer.getCurrentResult())
const unsubscribe = observer.subscribe(result => {
results.push(result)
})
await sleep(1)
observer.setQueries([
{ queryKey: undefined, queryFn: queryFn1 },
{ queryKey: '', queryFn: queryFn2 },
])
await sleep(1)
unsubscribe()
expect(results.length).toBe(4)
expect(results[0]).toMatchObject([{ status: 'idle', data: undefined }])
expect(results[1]).toMatchObject([{ status: 'loading', data: undefined }])
expect(results[2]).toMatchObject([{ status: 'success', data: 1 }])
expect(results[3]).toMatchObject([
{ status: 'success', data: 1 },
{ status: 'success', data: 1 },
])
})

test('should update when a query updates', async () => {
const key1 = queryKey()
const key2 = queryKey()
Expand Down

0 comments on commit d8d893f

Please sign in to comment.