chore: follow the general comments style

This commit is contained in:
Ilia Mashkov
2026-04-17 12:14:55 +03:00
parent 0ebf75b24e
commit cfaff46d59
56 changed files with 1600 additions and 499 deletions
@@ -5,7 +5,9 @@
* Controls network behaviour via vi.spyOn on the proxyFonts API layer.
*/
/** @vitest-environment jsdom */
/**
* @vitest-environment jsdom
*/
import type { UnifiedFont } from '$entities/Font';
import { UNIFIED_FONTS } from '$entities/Font/lib/mocks';
@@ -18,8 +20,6 @@ import {
vi,
} from 'vitest';
// ── Persistent-store mock ─────────────────────────────────────────────────────
const mockStorage = vi.hoisted(() => {
const storage: any = {};
storage._value = { fontAId: null, fontBId: null };
@@ -51,8 +51,6 @@ vi.mock('$shared/lib/helpers/createPersistentStore/createPersistentStore.svelte'
createPersistentStore: vi.fn(() => mockStorage),
}));
// ── $entities/Font mock — keep real BatchFontStore, stub singletons ───────────
vi.mock('$entities/Font', async importOriginal => {
const actual = await importOriginal<typeof import('$entities/Font')>();
const { BatchFontStore } = await import(
@@ -73,8 +71,6 @@ vi.mock('$entities/Font', async importOriginal => {
};
});
// ── $features/SetupFont mock ──────────────────────────────────────────────────
vi.mock('$features/SetupFont', () => ({
DEFAULT_TYPOGRAPHY_CONTROLS_DATA: [],
createTypographyControlManager: vi.fn(() => ({
@@ -92,8 +88,6 @@ vi.mock('$features/SetupFont/model', () => ({
},
}));
// ── Imports (after mocks) ─────────────────────────────────────────────────────
import {
appliedFontsManager,
fontStore,
@@ -101,8 +95,6 @@ import {
import * as proxyFonts from '$entities/Font/api/proxy/proxyFonts';
import { ComparisonStore } from './comparisonStore.svelte';
// ── Tests ─────────────────────────────────────────────────────────────────────
describe('ComparisonStore', () => {
const mockFontA: UnifiedFont = UNIFIED_FONTS.roboto; // id: 'roboto'
const mockFontB: UnifiedFont = UNIFIED_FONTS.openSans; // id: 'open-sans'
@@ -129,8 +121,6 @@ describe('ComparisonStore', () => {
});
});
// ── Initialization ────────────────────────────────────────────────────────
describe('Initialization', () => {
it('should create store with initial empty state', () => {
const store = new ComparisonStore();
@@ -139,8 +129,6 @@ describe('ComparisonStore', () => {
});
});
// ── Restoration from Storage ──────────────────────────────────────────────
describe('Restoration from Storage (via BatchFontStore)', () => {
it('should restore fontA and fontB from stored IDs', async () => {
mockStorage._value.fontAId = mockFontA.id;
@@ -169,8 +157,6 @@ describe('ComparisonStore', () => {
});
});
// ── Default Fallbacks ─────────────────────────────────────────────────────
describe('Default Fallbacks', () => {
it('should update storage with default IDs when storage is empty', async () => {
(fontStore as any).fonts = [mockFontA, mockFontB];
@@ -185,8 +171,6 @@ describe('ComparisonStore', () => {
});
});
// ── Loading State ─────────────────────────────────────────────────────────
describe('Aggregate Loading State', () => {
it('should be loading initially when storage has IDs', async () => {
mockStorage._value.fontAId = mockFontA.id;
@@ -202,8 +186,6 @@ describe('ComparisonStore', () => {
});
});
// ── Reset ─────────────────────────────────────────────────────────────────
describe('Reset Functionality', () => {
it('should reset all state and clear storage', () => {
const store = new ComparisonStore();
@@ -225,8 +207,6 @@ describe('ComparisonStore', () => {
});
});
// ── Pin / Unpin ───────────────────────────────────────────────────────────
describe('Pin / Unpin (eviction guard)', () => {
it('pins fontA and fontB when they are loaded', async () => {
mockStorage._value.fontAId = mockFontA.id;