From 0466adf087f3db3c89e112c8b1e18f40fbbc37e0 Mon Sep 17 00:00:00 2001 From: Espen Hovlandsdal Date: Thu, 11 Aug 2022 16:53:41 -0700 Subject: [PATCH] test: move TestProvider to testUtils as it is more generic than forms --- packages/sanity/src/form/studio/StudioFormBuilder.test.tsx | 2 +- packages/sanity/test/form/index.ts | 2 -- packages/sanity/test/form/renderInput.tsx | 2 +- packages/sanity/test/{form => testUtils}/TestProvider.tsx | 5 ++++- 4 files changed, 6 insertions(+), 5 deletions(-) rename packages/sanity/test/{form => testUtils}/TestProvider.tsx (85%) diff --git a/packages/sanity/src/form/studio/StudioFormBuilder.test.tsx b/packages/sanity/src/form/studio/StudioFormBuilder.test.tsx index 14405788069..814789352d4 100644 --- a/packages/sanity/src/form/studio/StudioFormBuilder.test.tsx +++ b/packages/sanity/src/form/studio/StudioFormBuilder.test.tsx @@ -5,7 +5,7 @@ import {defineType, Path} from '@sanity/types' import {render} from '@testing-library/react' import React, {useMemo} from 'react' import {createMockSanityClient} from '../../../test/mocks/mockSanityClient' -import {createTestProvider} from '../../../test/form' +import {createTestProvider} from '../../../test/testUtils/TestProvider' import {createPatchChannel} from '../patch' import {useFormState} from '../store/useFormState' import {EMPTY_ARRAY} from '../utils/empty' diff --git a/packages/sanity/test/form/index.ts b/packages/sanity/test/form/index.ts index 2573ad8c0be..f6d8b6efa51 100644 --- a/packages/sanity/test/form/index.ts +++ b/packages/sanity/test/form/index.ts @@ -6,5 +6,3 @@ export * from './renderImageInput' export * from './renderNumberInput' export * from './renderObjectInput' export * from './renderStringInput' - -export * from './TestProvider' diff --git a/packages/sanity/test/form/renderInput.tsx b/packages/sanity/test/form/renderInput.tsx index 169b3fcc3f8..6db74bcbef6 100644 --- a/packages/sanity/test/form/renderInput.tsx +++ b/packages/sanity/test/form/renderInput.tsx @@ -17,7 +17,7 @@ import {FormState} from '../../src/form/store/useFormState' import {EMPTY_ARRAY} from '../../src/form/utils/empty' import {useSchema} from '../../src/hooks' import {createMockSanityClient} from '../mocks/mockSanityClient' -import {createTestProvider} from './TestProvider' +import {createTestProvider} from '../testUtils/TestProvider' import {TestRenderProps} from './types' export interface TestRenderInputContext { diff --git a/packages/sanity/test/form/TestProvider.tsx b/packages/sanity/test/testUtils/TestProvider.tsx similarity index 85% rename from packages/sanity/test/form/TestProvider.tsx rename to packages/sanity/test/testUtils/TestProvider.tsx index a08c9a41495..f4e0a3ed654 100644 --- a/packages/sanity/test/form/TestProvider.tsx +++ b/packages/sanity/test/testUtils/TestProvider.tsx @@ -3,6 +3,7 @@ import {SanityClient} from '@sanity/client' import {LayerProvider, studioTheme, ThemeProvider, ToastProvider} from '@sanity/ui' import {createWorkspaceFromConfig, SingleWorkspace} from '../../src/config' import {SourceProvider, WorkspaceProvider} from '../../src/studio' +import {ResourceCacheProvider} from '../../src/datastores/ResourceCacheProvider' interface TestProviderOptions { config: SingleWorkspace @@ -25,7 +26,9 @@ export async function createTestProvider({client, config}: TestProviderOptions) - {children} + + {children} +