|
1 | 1 | import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
|
| 2 | +import { |
| 3 | + QueryClientProvider as QueryClientProviderV5, |
| 4 | + QueryClient as QueryClientV5, |
| 5 | +} from '@tanstack/react-queryV5' |
2 | 6 | import { render, screen, waitFor } from '@testing-library/react'
|
3 | 7 | import { graphql, HttpResponse } from 'msw'
|
4 | 8 | import { setupServer } from 'msw/node'
|
| 9 | +import { Suspense } from 'react' |
5 | 10 | import { MemoryRouter, Route } from 'react-router-dom'
|
6 | 11 |
|
7 | 12 | import HeaderTeam from './HeaderTeam'
|
@@ -43,25 +48,39 @@ const mockData = (pullId = null) => ({
|
43 | 48 | },
|
44 | 49 | })
|
45 | 50 |
|
| 51 | +const server = setupServer() |
46 | 52 | const queryClient = new QueryClient({
|
47 | 53 | defaultOptions: { queries: { retry: false } },
|
48 | 54 | })
|
49 |
| -const server = setupServer() |
| 55 | +const queryClientV5 = new QueryClientV5({ |
| 56 | + defaultOptions: { queries: { retry: false } }, |
| 57 | +}) |
50 | 58 |
|
51 | 59 | const wrapper = ({ children }) => (
|
52 |
| - <QueryClientProvider client={queryClient}> |
53 |
| - <MemoryRouter initialEntries={['/gh/codecov/test-repo/commit/id-1']}> |
54 |
| - <Route path="/:provider/:owner/:repo/commit/:commit">{children}</Route> |
55 |
| - </MemoryRouter> |
56 |
| - </QueryClientProvider> |
| 60 | + <QueryClientProviderV5 client={queryClientV5}> |
| 61 | + <QueryClientProvider client={queryClient}> |
| 62 | + <MemoryRouter initialEntries={['/gh/codecov/test-repo/commit/id-1']}> |
| 63 | + <Route path="/:provider/:owner/:repo/commit/:commit"> |
| 64 | + <Suspense fallback={<div>Loading</div>}>{children}</Suspense> |
| 65 | + </Route> |
| 66 | + </MemoryRouter> |
| 67 | + </QueryClientProvider> |
| 68 | + </QueryClientProviderV5> |
57 | 69 | )
|
58 | 70 |
|
59 |
| -beforeAll(() => server.listen()) |
| 71 | +beforeAll(() => { |
| 72 | + server.listen() |
| 73 | +}) |
| 74 | + |
60 | 75 | afterEach(() => {
|
61 | 76 | queryClient.clear()
|
| 77 | + queryClientV5.clear() |
62 | 78 | server.resetHandlers()
|
63 | 79 | })
|
64 |
| -afterAll(() => server.close()) |
| 80 | + |
| 81 | +afterAll(() => { |
| 82 | + server.close() |
| 83 | +}) |
65 | 84 |
|
66 | 85 | describe('HeaderTeam', () => {
|
67 | 86 | function setup(pullId = 1234) {
|
|
0 commit comments