Skip to content

Commit

Permalink
update usage in EnterpriseLandingPage
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholas-codecov committed Dec 11, 2024
1 parent 801b046 commit 2cb6f1a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 10 deletions.
28 changes: 20 additions & 8 deletions src/pages/EnterpriseLandingPage/EnterpriseLandingPage.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
import {
QueryClientProvider as QueryClientProviderV5,
QueryClient as QueryClientV5,
} from '@tanstack/react-queryV5'
import { render, screen } from '@testing-library/react'
import { graphql, HttpResponse } from 'msw'
import { setupServer } from 'msw/node'
Expand All @@ -11,16 +15,23 @@ import EnterpriseLandingPage from './EnterpriseLandingPage'
vi.mock('config')

const server = setupServer()
const queryClient = new QueryClient()
const queryClient = new QueryClient({
defaultOptions: { queries: { retry: false } },
})
const queryClientV5 = new QueryClientV5({
defaultOptions: { queries: { retry: false } },
})

const wrapper: React.FC<React.PropsWithChildren> = ({ children }) => (
<QueryClientProvider client={queryClient}>
<ThemeContextProvider>
<MemoryRouter initialEntries={['/']}>
<Route path="/">{children}</Route>
</MemoryRouter>
</ThemeContextProvider>
</QueryClientProvider>
<QueryClientProviderV5 client={queryClientV5}>
<QueryClientProvider client={queryClient}>
<ThemeContextProvider>
<MemoryRouter initialEntries={['/']}>
<Route path="/">{children}</Route>
</MemoryRouter>
</ThemeContextProvider>
</QueryClientProvider>
</QueryClientProviderV5>
)

const mockServiceProviders = {
Expand All @@ -43,6 +54,7 @@ beforeAll(() => {

afterEach(() => {
queryClient.clear()
queryClientV5.clear()
server.resetHandlers()
})

Expand Down
6 changes: 4 additions & 2 deletions src/pages/EnterpriseLandingPage/EnterpriseLandingPage.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { useSuspenseQuery as useSuspenseQueryV5 } from '@tanstack/react-queryV5'

import rocketImg from 'assets/enterprise-rocket.png'
import { useLoginProviders } from 'services/config/useLoginProviders'
import { LoginProvidersQueryOpts } from 'services/config/LoginProvidersQueryOpts'
import { LoginProvidersEnum } from 'shared/utils/loginProviders'

import ProviderCard from './ProviderCard/ProviderCard'
Expand All @@ -8,7 +10,7 @@ import { useEnterpriseRedirect } from './useEnterpriseRedirect'
function EnterpriseLandingPage() {
useEnterpriseRedirect()

const { data } = useLoginProviders()
const { data } = useSuspenseQueryV5(LoginProvidersQueryOpts())

return (
<div className="flex flex-col gap-5">
Expand Down

0 comments on commit 2cb6f1a

Please sign in to comment.