diff --git a/static/config.yml b/static/config.yml index 218c8f5..ab1d479 100644 --- a/static/config.yml +++ b/static/config.yml @@ -1,5 +1,5 @@ meta: - version: "1.2.1" + version: "1.2.2" llm: default_modes: diff --git a/web/src/__tests__/setup.ts b/web/src/__tests__/setup.ts index 77ee821..10b0456 100644 --- a/web/src/__tests__/setup.ts +++ b/web/src/__tests__/setup.ts @@ -1,4 +1,4 @@ -import { vi, beforeEach, afterEach, beforeAll, afterAll } from 'vitest' +import { vi, beforeEach, afterEach } from 'vitest' import { createPinia, setActivePinia } from 'pinia' // Use fake timers globally for consistent async testing. diff --git a/web/src/__tests__/stores/system.test.ts b/web/src/__tests__/stores/system.test.ts index bf559a5..0f2914a 100644 --- a/web/src/__tests__/stores/system.test.ts +++ b/web/src/__tests__/stores/system.test.ts @@ -1,5 +1,6 @@ import { describe, it, expect, vi, beforeEach } from 'vitest' import { useSystemStore } from '@/stores/system' +import type { InitStatusDTO } from '@/types/api' // Mock the API module. vi.mock('@/api', () => ({ @@ -12,6 +13,18 @@ vi.mock('@/api', () => ({ import { systemApi } from '@/api' +const createMockStatus = (overrides: Partial = {}): InitStatusDTO => ({ + status: 'idle', + phase: 0, + phase_name: '', + progress: 0, + elapsed_seconds: 0, + error: null, + llm_check_failed: false, + llm_error_message: '', + ...overrides, +}) + describe('useSystemStore', () => { let store: ReturnType @@ -35,17 +48,17 @@ describe('useSystemStore', () => { }) it('should return false when status is idle', () => { - store.initStatus = { status: 'idle', progress: 0 } + store.initStatus = createMockStatus({ status: 'idle', progress: 0 }) expect(store.isLoading).toBe(false) }) it('should return true when status is in_progress', () => { - store.initStatus = { status: 'in_progress', progress: 50 } + store.initStatus = createMockStatus({ status: 'in_progress', progress: 50 }) expect(store.isLoading).toBe(true) }) it('should return false when status is ready and initialized', () => { - store.initStatus = { status: 'ready', progress: 100 } + store.initStatus = createMockStatus({ status: 'ready', progress: 100 }) store.setInitialized(true) expect(store.isLoading).toBe(false) }) @@ -53,12 +66,12 @@ describe('useSystemStore', () => { describe('isReady', () => { it('should return false when not initialized', () => { - store.initStatus = { status: 'ready', progress: 100 } + store.initStatus = createMockStatus({ status: 'ready', progress: 100 }) expect(store.isReady).toBe(false) }) it('should return true when status is ready and initialized', () => { - store.initStatus = { status: 'ready', progress: 100 } + store.initStatus = createMockStatus({ status: 'ready', progress: 100 }) store.setInitialized(true) expect(store.isReady).toBe(true) }) diff --git a/web/src/__tests__/utils/eventHelper.test.ts b/web/src/__tests__/utils/eventHelper.test.ts index 503566d..510537c 100644 --- a/web/src/__tests__/utils/eventHelper.test.ts +++ b/web/src/__tests__/utils/eventHelper.test.ts @@ -6,6 +6,7 @@ import { buildAvatarColorMap, highlightAvatarNames, MAX_EVENTS, + type AvatarColorInfo, } from '@/utils/eventHelper' import type { GameEvent } from '@/types/core' @@ -56,7 +57,7 @@ describe('eventHelper', () => { month: timestamp % 12, text: `Event ${id}`, relatedAvatarIds: [], - }) + } as any) // Partial mock is enough for sorting logic it('should merge events without duplicates', () => { const existing = [createEvent('1', 100), createEvent('2', 101)] @@ -155,7 +156,9 @@ describe('eventHelper', () => { }) it('should highlight avatar names with color spans', () => { - const colorMap = new Map([['Alice', 'hsl(100, 70%, 65%)']]) + const colorMap = new Map([ + ['Alice', { id: 'Alice', color: 'hsl(100, 70%, 65%)' }] + ]) const text = 'Alice defeated the enemy' const result = highlightAvatarNames(text, colorMap) @@ -166,7 +169,9 @@ describe('eventHelper', () => { }) it('should escape HTML in names', () => { - const colorMap = new Map([['