@tanstack/react-query-devtools 5.0.0-alpha.3 → 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-devtools",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.5",
|
|
4
4
|
"description": "Developer tools to interact with and visualize the TanStack/react-query cache",
|
|
5
5
|
"author": "tannerlinsley",
|
|
6
6
|
"license": "MIT",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"react": "^18.2.0",
|
|
44
44
|
"react-dom": "^18.2.0",
|
|
45
45
|
"react-error-boundary": "^3.1.4",
|
|
46
|
-
"@tanstack/react-query": "5.0.0-alpha.
|
|
46
|
+
"@tanstack/react-query": "5.0.0-alpha.5"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"@tanstack/match-sorter-utils": "^8.7.0",
|
|
@@ -52,13 +52,13 @@
|
|
|
52
52
|
"peerDependencies": {
|
|
53
53
|
"react": "^18.0.0",
|
|
54
54
|
"react-dom": "^18.0.0",
|
|
55
|
-
"@tanstack/react-query": "5.0.0-alpha.
|
|
55
|
+
"@tanstack/react-query": "5.0.0-alpha.5"
|
|
56
56
|
},
|
|
57
57
|
"scripts": {
|
|
58
58
|
"clean": "rimraf ./build",
|
|
59
59
|
"test:eslint": "eslint --ext .ts,.tsx ./src",
|
|
60
60
|
"test:types": "tsc",
|
|
61
|
-
"test:lib": "
|
|
61
|
+
"test:lib": "vitest run --coverage",
|
|
62
62
|
"test:lib:dev": "pnpm run test:lib --watch",
|
|
63
63
|
"build:types": "tsc --build && cp build/lib/index.d.ts build/lib/index.prod.d.ts"
|
|
64
64
|
}
|
|
@@ -3,6 +3,7 @@ import * as React from 'react'
|
|
|
3
3
|
|
|
4
4
|
import { chunkArray, CopyButton, DefaultRenderer } from '../Explorer'
|
|
5
5
|
import { displayValue } from '../utils'
|
|
6
|
+
import { vi } from 'vitest'
|
|
6
7
|
|
|
7
8
|
describe('Explorer', () => {
|
|
8
9
|
describe('chunkArray', () => {
|
|
@@ -30,7 +31,7 @@ describe('Explorer', () => {
|
|
|
30
31
|
|
|
31
32
|
describe('DefaultRenderer', () => {
|
|
32
33
|
it('when the entry label is clicked, toggle expanded', async () => {
|
|
33
|
-
const toggleExpanded =
|
|
34
|
+
const toggleExpanded = vi.fn()
|
|
34
35
|
|
|
35
36
|
render(
|
|
36
37
|
<DefaultRenderer
|
|
@@ -90,7 +91,7 @@ describe('Explorer', () => {
|
|
|
90
91
|
})
|
|
91
92
|
|
|
92
93
|
it('when the copy button is clicked but there is an error, show error state', async () => {
|
|
93
|
-
const consoleMock =
|
|
94
|
+
const consoleMock = vi.spyOn(console, 'error')
|
|
94
95
|
consoleMock.mockImplementation(() => undefined)
|
|
95
96
|
|
|
96
97
|
// Mock clipboard with error state
|
|
@@ -9,18 +9,19 @@ import {
|
|
|
9
9
|
sleep,
|
|
10
10
|
createQueryClient,
|
|
11
11
|
} from './utils'
|
|
12
|
+
import { vi } from 'vitest'
|
|
12
13
|
|
|
13
14
|
Object.defineProperty(window, 'matchMedia', {
|
|
14
15
|
writable: true,
|
|
15
|
-
value:
|
|
16
|
+
value: vi.fn().mockImplementation((query: string) => ({
|
|
16
17
|
matches: false,
|
|
17
18
|
media: query,
|
|
18
19
|
onchange: null,
|
|
19
|
-
addListener:
|
|
20
|
-
removeListener:
|
|
21
|
-
addEventListener:
|
|
22
|
-
removeEventListener:
|
|
23
|
-
dispatchEvent:
|
|
20
|
+
addListener: vi.fn(), // deprecated
|
|
21
|
+
removeListener: vi.fn(), // deprecated
|
|
22
|
+
addEventListener: vi.fn(),
|
|
23
|
+
removeEventListener: vi.fn(),
|
|
24
|
+
dispatchEvent: vi.fn(),
|
|
24
25
|
})),
|
|
25
26
|
})
|
|
26
27
|
|
|
@@ -31,8 +32,8 @@ describe('ReactQueryDevtools', () => {
|
|
|
31
32
|
})
|
|
32
33
|
it('should be able to open and close devtools', async () => {
|
|
33
34
|
const { queryClient } = createQueryClient()
|
|
34
|
-
const onCloseClick =
|
|
35
|
-
const onToggleClick =
|
|
35
|
+
const onCloseClick = vi.fn()
|
|
36
|
+
const onToggleClick = vi.fn()
|
|
36
37
|
|
|
37
38
|
function Page() {
|
|
38
39
|
const { data = 'default' } = useQuery({
|