From 49e131db8f2960b5aa442d27c745517bc987b384 Mon Sep 17 00:00:00 2001 From: Matthew Warman Date: Tue, 4 Jun 2024 15:19:41 -0400 Subject: [PATCH] #48 test wrappers --- src/api/__tests__/useGetUserTokens.test.ts | 2 +- src/test/test-utils.tsx | 2 +- src/test/{ => wrappers}/AllProvidersExceptRouter.tsx | 2 +- src/test/{ => wrappers}/WithAllProviders.tsx | 2 +- src/test/{ => wrappers}/WithQueryClientProvider.tsx | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) rename src/test/{ => wrappers}/AllProvidersExceptRouter.tsx (97%) rename src/test/{ => wrappers}/WithAllProviders.tsx (96%) rename src/test/{ => wrappers}/WithQueryClientProvider.tsx (94%) diff --git a/src/api/__tests__/useGetUserTokens.test.ts b/src/api/__tests__/useGetUserTokens.test.ts index ecc2f85..0aa2511 100644 --- a/src/api/__tests__/useGetUserTokens.test.ts +++ b/src/api/__tests__/useGetUserTokens.test.ts @@ -2,7 +2,7 @@ import { beforeEach, describe, expect, it, vi } from 'vitest'; import dayjs from 'dayjs'; import { renderHook, waitFor } from 'test/test-utils'; -import WithQueryClientProvider from 'test/WithQueryClientProvider'; +import WithQueryClientProvider from 'test/wrappers/WithQueryClientProvider'; import storage from 'utils/storage'; import { userTokensFixture } from '__fixtures__/tokens'; diff --git a/src/test/test-utils.tsx b/src/test/test-utils.tsx index 1b1e547..47cf2c9 100644 --- a/src/test/test-utils.tsx +++ b/src/test/test-utils.tsx @@ -8,7 +8,7 @@ import { } from '@testing-library/react'; import 'utils/i18n'; -import WithAllProviders from './WithAllProviders'; +import WithAllProviders from './wrappers/WithAllProviders'; const customRender = (ui: React.ReactElement, options?: RenderOptions, { route = '/' } = {}) => { window.history.pushState({}, 'Test page', route); diff --git a/src/test/AllProvidersExceptRouter.tsx b/src/test/wrappers/AllProvidersExceptRouter.tsx similarity index 97% rename from src/test/AllProvidersExceptRouter.tsx rename to src/test/wrappers/AllProvidersExceptRouter.tsx index 3f2eabb..5d302c2 100644 --- a/src/test/AllProvidersExceptRouter.tsx +++ b/src/test/wrappers/AllProvidersExceptRouter.tsx @@ -6,7 +6,7 @@ import SettingsContextProvider from 'providers/SettingsProvider'; import AuthContextProvider from 'providers/AuthProvider'; import ToastsProvider from 'providers/ToastsProvider'; -import { queryClient } from './query-client'; +import { queryClient } from '../query-client'; /** * A React test wrapper. Wraps the component under test with a bespoke set diff --git a/src/test/WithAllProviders.tsx b/src/test/wrappers/WithAllProviders.tsx similarity index 96% rename from src/test/WithAllProviders.tsx rename to src/test/wrappers/WithAllProviders.tsx index c6b4295..cdcdcdd 100644 --- a/src/test/WithAllProviders.tsx +++ b/src/test/wrappers/WithAllProviders.tsx @@ -7,7 +7,7 @@ import SettingsContextProvider from 'providers/SettingsProvider'; import AuthContextProvider from 'providers/AuthProvider'; import ToastsProvider from 'providers/ToastsProvider'; -import { queryClient } from './query-client'; +import { queryClient } from '../query-client'; /** * The default React test wrapper. Wraps the component under test with a set diff --git a/src/test/WithQueryClientProvider.tsx b/src/test/wrappers/WithQueryClientProvider.tsx similarity index 94% rename from src/test/WithQueryClientProvider.tsx rename to src/test/wrappers/WithQueryClientProvider.tsx index cf85f01..4472290 100644 --- a/src/test/WithQueryClientProvider.tsx +++ b/src/test/wrappers/WithQueryClientProvider.tsx @@ -2,7 +2,7 @@ import { PropsWithChildren } from 'react'; import { MemoryRouter } from 'react-router-dom'; import { QueryClientProvider } from '@tanstack/react-query'; -import { queryClient } from './query-client'; +import { queryClient } from '../query-client'; /** * A React test wrapper. Wraps the component under test with a bespoke set