diff --git a/src/entities/Font/model/store/fontCatalogStore/fontCatalogStore.svelte.spec.ts b/src/entities/Font/model/store/fontCatalogStore/fontCatalogStore.svelte.spec.ts index 912d1d6..230512e 100644 --- a/src/entities/Font/model/store/fontCatalogStore/fontCatalogStore.svelte.spec.ts +++ b/src/entities/Font/model/store/fontCatalogStore/fontCatalogStore.svelte.spec.ts @@ -2,7 +2,6 @@ import { generateMixedCategoryFonts, generateMockFonts, } from '$entities/Font/testing'; -import { QueryClient } from '@tanstack/query-core'; import { flushSync } from 'svelte'; import { afterEach, @@ -20,6 +19,13 @@ import type { UnifiedFont } from '../../types'; import { FontCatalogStore } from './fontCatalogStore.svelte'; vi.mock('$shared/api/queryClient', async importOriginal => { + /** + * Import QueryClient inside the factory rather than referencing the top-level binding. + * A hoisted vi.mock factory that touches a module-level import can hit that import + * before it is initialized (ReferenceError) when the import sits in a circular/eager + * barrel chain — which it now does via $shared/lib → BaseQueryStore → query-core. + */ + const { QueryClient } = await import('@tanstack/query-core'); const actual = await importOriginal(); return { ...actual,