@tanstack/react-query-persist-client 5.0.0-alpha.4 → 5.0.0-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/react-query-persist-client",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.5",
|
|
4
4
|
"description": "React bindings to work with persisters in TanStack/react-query",
|
|
5
5
|
"author": "tannerlinsley",
|
|
6
6
|
"license": "MIT",
|
|
@@ -32,19 +32,19 @@
|
|
|
32
32
|
"@types/react-dom": "^18.0.5",
|
|
33
33
|
"react": "^18.2.0",
|
|
34
34
|
"react-dom": "^18.2.0",
|
|
35
|
-
"@tanstack/react-query": "5.0.0-alpha.
|
|
35
|
+
"@tanstack/react-query": "5.0.0-alpha.5"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@tanstack/query-persist-client-core": "5.0.0-alpha.
|
|
38
|
+
"@tanstack/query-persist-client-core": "5.0.0-alpha.5"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
|
-
"@tanstack/react-query": "5.0.0-alpha.
|
|
41
|
+
"@tanstack/react-query": "5.0.0-alpha.5"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
44
|
"clean": "rimraf ./build",
|
|
45
45
|
"test:eslint": "eslint --ext .ts,.tsx ./src",
|
|
46
46
|
"test:types": "tsc",
|
|
47
|
-
"test:lib": "
|
|
47
|
+
"test:lib": "vitest run --coverage",
|
|
48
48
|
"test:lib:dev": "pnpm run test:lib --watch",
|
|
49
49
|
"build:types": "tsc --build"
|
|
50
50
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from 'react'
|
|
2
2
|
import { render, waitFor } from '@testing-library/react'
|
|
3
|
+
import { vi } from 'vitest'
|
|
3
4
|
|
|
4
5
|
import type {
|
|
5
6
|
UseQueryResult,
|
|
@@ -382,7 +383,7 @@ describe('PersistQueryClientProvider', () => {
|
|
|
382
383
|
)
|
|
383
384
|
}
|
|
384
385
|
|
|
385
|
-
const onSuccess =
|
|
386
|
+
const onSuccess = vi.fn()
|
|
386
387
|
|
|
387
388
|
const rendered = render(
|
|
388
389
|
<PersistQueryClientProvider
|
|
@@ -402,14 +403,14 @@ describe('PersistQueryClientProvider', () => {
|
|
|
402
403
|
|
|
403
404
|
test('should remove cache after non-successful restoring', async () => {
|
|
404
405
|
const key = queryKey()
|
|
405
|
-
const consoleMock =
|
|
406
|
-
const consoleWarn =
|
|
406
|
+
const consoleMock = vi.spyOn(console, 'error')
|
|
407
|
+
const consoleWarn = vi
|
|
407
408
|
.spyOn(console, 'warn')
|
|
408
409
|
.mockImplementation(() => undefined)
|
|
409
410
|
consoleMock.mockImplementation(() => undefined)
|
|
410
411
|
|
|
411
412
|
const queryClient = createQueryClient()
|
|
412
|
-
const removeClient =
|
|
413
|
+
const removeClient = vi.fn()
|
|
413
414
|
|
|
414
415
|
const [error, persister] = createMockErrorPersister(removeClient)
|
|
415
416
|
|
|
@@ -463,13 +464,13 @@ describe('PersistQueryClientProvider', () => {
|
|
|
463
464
|
|
|
464
465
|
queryClient.clear()
|
|
465
466
|
|
|
466
|
-
const onSuccess =
|
|
467
|
+
const onSuccess = vi.fn()
|
|
467
468
|
|
|
468
|
-
const queryFn1 =
|
|
469
|
+
const queryFn1 = vi.fn().mockImplementation(async () => {
|
|
469
470
|
await sleep(10)
|
|
470
471
|
return 'queryFn1'
|
|
471
472
|
})
|
|
472
|
-
const queryFn2 =
|
|
473
|
+
const queryFn2 = vi.fn().mockImplementation(async () => {
|
|
473
474
|
await sleep(10)
|
|
474
475
|
return 'queryFn2'
|
|
475
476
|
})
|