refactor: extract BatchFontStore into new FetchFontsByIds feature
The byId font fetch was a verb-oriented capability with a single consumer driven by a feature need (materializing comparison picks). That shape belongs at the feature layer, not on the entity. Move: - entities/Font/model/store/batchFontStore -> features/FetchFontsByIds/model/store/fontsByIdsStore - Class BatchFontStore -> FontsByIdsStore entities/Font retains the transport primitives (fetchFontsByIds, seedFontCache) and the keyspace (fontKeys); the feature wraps them in the reactive store. comparisonStore now imports FontsByIdsStore from the new feature. The proxy API is imported via direct path so vi.spyOn on the source module still observes the call.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* Unit tests for ComparisonStore (TanStack Query refactor)
|
||||
*
|
||||
* Uses the real BatchFontStore so Svelte $state reactivity works correctly.
|
||||
* Uses the real FontsByIdsStore so Svelte $state reactivity works correctly.
|
||||
* Controls network behaviour via vi.spyOn on the proxyFonts API layer.
|
||||
*/
|
||||
|
||||
@@ -53,12 +53,8 @@ vi.mock('$shared/lib/helpers/createPersistentStore/createPersistentStore.svelte'
|
||||
|
||||
vi.mock('$entities/Font', async importOriginal => {
|
||||
const actual = await importOriginal<typeof import('$entities/Font')>();
|
||||
const { BatchFontStore } = await import(
|
||||
'$entities/Font/model/store/batchFontStore/batchFontStore.svelte'
|
||||
);
|
||||
return {
|
||||
...actual,
|
||||
BatchFontStore,
|
||||
fontStore: { fonts: [] },
|
||||
appliedFontsManager: {
|
||||
touch: vi.fn(),
|
||||
@@ -129,7 +125,7 @@ describe('ComparisonStore', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('Restoration from Storage (via BatchFontStore)', () => {
|
||||
describe('Restoration from Storage (via FontsByIdsStore)', () => {
|
||||
it('should restore fontA and fontB from stored IDs', async () => {
|
||||
mockStorage._value.fontAId = mockFontA.id;
|
||||
mockStorage._value.fontBId = mockFontB.id;
|
||||
|
||||
Reference in New Issue
Block a user