Refactor/reacrhitecture to fsd+ #49
@@ -3,3 +3,6 @@ export * from './domain';
|
|||||||
export * from './lib';
|
export * from './lib';
|
||||||
export * from './model';
|
export * from './model';
|
||||||
export * from './ui';
|
export * from './ui';
|
||||||
|
|
||||||
|
// `./testing` is intentionally not re-exported: fixtures must not leak into the
|
||||||
|
// production public API. Import them via `$entities/Font/testing`.
|
||||||
|
|||||||
@@ -1,49 +1,5 @@
|
|||||||
export { getFontUrl } from './getFontUrl/getFontUrl';
|
export { getFontUrl } from './getFontUrl/getFontUrl';
|
||||||
|
|
||||||
// Mock data helpers for Storybook and testing
|
|
||||||
export {
|
|
||||||
createCategoriesFilter,
|
|
||||||
createErrorState,
|
|
||||||
createGenericFilter,
|
|
||||||
createLoadingState,
|
|
||||||
createMockComparisonStore,
|
|
||||||
// Filter mocks
|
|
||||||
createMockFilter,
|
|
||||||
createMockFontApiResponse,
|
|
||||||
createMockFontStoreState,
|
|
||||||
// Store mocks
|
|
||||||
createMockQueryState,
|
|
||||||
createMockReactiveState,
|
|
||||||
createMockStore,
|
|
||||||
createProvidersFilter,
|
|
||||||
createSubsetsFilter,
|
|
||||||
createSuccessState,
|
|
||||||
generateMixedCategoryFonts,
|
|
||||||
generateMockFonts,
|
|
||||||
generatePaginatedFonts,
|
|
||||||
generateSequentialFilter,
|
|
||||||
GENERIC_FILTERS,
|
|
||||||
getAllMockFonts,
|
|
||||||
getFontsByCategory,
|
|
||||||
getFontsByProvider,
|
|
||||||
MOCK_FILTERS,
|
|
||||||
MOCK_FILTERS_ALL_SELECTED,
|
|
||||||
MOCK_FILTERS_EMPTY,
|
|
||||||
MOCK_FILTERS_SELECTED,
|
|
||||||
MOCK_FONT_STORE_STATES,
|
|
||||||
MOCK_STORES,
|
|
||||||
type MockFilterOptions,
|
|
||||||
type MockFilters,
|
|
||||||
type MockFontStoreState,
|
|
||||||
// Font mocks
|
|
||||||
// Types
|
|
||||||
type MockQueryObserverResult,
|
|
||||||
type MockQueryState,
|
|
||||||
mockUnifiedFont,
|
|
||||||
type MockUnifiedFontOptions,
|
|
||||||
UNIFIED_FONTS,
|
|
||||||
} from './mocks';
|
|
||||||
|
|
||||||
export {
|
export {
|
||||||
FontNetworkError,
|
FontNetworkError,
|
||||||
FontResponseError,
|
FontResponseError,
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ vi.mock('@chenglou/pretext', async () => {
|
|||||||
layout: vi.fn(actual.layout),
|
layout: vi.fn(actual.layout),
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
import { mockUnifiedFont } from '$entities/Font/testing';
|
||||||
import {
|
import {
|
||||||
beforeEach,
|
beforeEach,
|
||||||
describe,
|
describe,
|
||||||
@@ -22,7 +23,6 @@ import {
|
|||||||
vi,
|
vi,
|
||||||
} from 'vitest';
|
} from 'vitest';
|
||||||
import type { FontLoadStatus } from '../../model/types';
|
import type { FontLoadStatus } from '../../model/types';
|
||||||
import { mockUnifiedFont } from '../mocks';
|
|
||||||
import { createFontRowSizeResolver } from './createFontRowSizeResolver';
|
import { createFontRowSizeResolver } from './createFontRowSizeResolver';
|
||||||
|
|
||||||
// Fixed-width canvas mock: every character is 10px wide regardless of font.
|
// Fixed-width canvas mock: every character is 10px wide regardless of font.
|
||||||
|
|||||||
@@ -1,3 +1,7 @@
|
|||||||
|
import {
|
||||||
|
generateMixedCategoryFonts,
|
||||||
|
generateMockFonts,
|
||||||
|
} from '$entities/Font/testing';
|
||||||
import { QueryClient } from '@tanstack/query-core';
|
import { QueryClient } from '@tanstack/query-core';
|
||||||
import { flushSync } from 'svelte';
|
import { flushSync } from 'svelte';
|
||||||
import {
|
import {
|
||||||
@@ -12,10 +16,6 @@ import {
|
|||||||
FontNetworkError,
|
FontNetworkError,
|
||||||
FontResponseError,
|
FontResponseError,
|
||||||
} from '../../../lib/errors/errors';
|
} from '../../../lib/errors/errors';
|
||||||
import {
|
|
||||||
generateMixedCategoryFonts,
|
|
||||||
generateMockFonts,
|
|
||||||
} from '../../../lib/mocks/fonts.mock';
|
|
||||||
import type { UnifiedFont } from '../../types';
|
import type { UnifiedFont } from '../../types';
|
||||||
import { FontCatalogStore } from './fontCatalogStore.svelte';
|
import { FontCatalogStore } from './fontCatalogStore.svelte';
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
* GOOGLE_FONTS,
|
* GOOGLE_FONTS,
|
||||||
* FONTHARE_FONTS,
|
* FONTHARE_FONTS,
|
||||||
* UNIFIED_FONTS,
|
* UNIFIED_FONTS,
|
||||||
* } from '$entities/Font/lib/mocks';
|
* } from '$entities/Font/testing';
|
||||||
*
|
*
|
||||||
* // Create a mock Google Font
|
* // Create a mock Google Font
|
||||||
* const roboto = mockGoogleFont({ family: 'Roboto', category: 'sans-serif' });
|
* const roboto = mockGoogleFont({ family: 'Roboto', category: 'sans-serif' });
|
||||||
@@ -28,7 +28,7 @@
|
|||||||
* const font = mockUnifiedFont({ id: 'roboto', name: 'Roboto' });
|
* const font = mockUnifiedFont({ id: 'roboto', name: 'Roboto' });
|
||||||
*
|
*
|
||||||
* // Use preset fonts
|
* // Use preset fonts
|
||||||
* import { UNIFIED_FONTS } from '$entities/Font/lib/mocks';
|
* import { UNIFIED_FONTS } from '$entities/Font/testing';
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
* UNIFIED_FONTS,
|
* UNIFIED_FONTS,
|
||||||
* MOCK_FILTERS,
|
* MOCK_FILTERS,
|
||||||
* createMockFontStoreState,
|
* createMockFontStoreState,
|
||||||
* } from '$entities/Font/lib/mocks';
|
* } from '$entities/Font/testing';
|
||||||
*
|
*
|
||||||
* // Use in stories
|
* // Use in stories
|
||||||
* const font = mockUnifiedFont({ name: 'My Font', category: 'serif' });
|
* const font = mockUnifiedFont({ name: 'My Font', category: 'serif' });
|
||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
* import {
|
* import {
|
||||||
* createMockQueryState,
|
* createMockQueryState,
|
||||||
* MOCK_STORES,
|
* MOCK_STORES,
|
||||||
* } from '$entities/Font/lib/mocks';
|
* } from '$entities/Font/testing';
|
||||||
*
|
*
|
||||||
* // Create a mock query state
|
* // Create a mock query state
|
||||||
* const loadingState = createMockQueryState({ status: 'pending' });
|
* const loadingState = createMockQueryState({ status: 'pending' });
|
||||||
@@ -23,7 +23,7 @@ const { Story } = defineMeta({
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { mockUnifiedFont } from '$entities/Font/lib/mocks';
|
import { mockUnifiedFont } from '$entities/Font/testing';
|
||||||
import type { ComponentProps } from 'svelte';
|
import type { ComponentProps } from 'svelte';
|
||||||
|
|
||||||
const fontUnknown = mockUnifiedFont({ id: 'nonexistent-font-xk92z', name: 'Nonexistent Font Xk92z' });
|
const fontUnknown = mockUnifiedFont({ id: 'nonexistent-font-xk92z', name: 'Nonexistent Font Xk92z' });
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import type { UnifiedFont } from '$entities/Font';
|
import type { UnifiedFont } from '$entities/Font';
|
||||||
import { UNIFIED_FONTS } from '$entities/Font/lib/mocks';
|
import { UNIFIED_FONTS } from '$entities/Font/testing';
|
||||||
import { queryClient } from '$shared/api/queryClient';
|
import { queryClient } from '$shared/api/queryClient';
|
||||||
import {
|
import {
|
||||||
beforeEach,
|
beforeEach,
|
||||||
|
|||||||
Reference in New Issue
Block a user