From 8f3e60012236c881bfec659262bec41ea8c1fc48 Mon Sep 17 00:00:00 2001 From: Johnpaul Date: Mon, 26 Jan 2026 01:41:39 +0100 Subject: [PATCH] test: replace any with MockSettingParams in useSettingSearch test Replace any type in mockSettings with Record. Define MockSettingParams interface to match the test mock structure, improving type safety without coupling to production SettingParams schema. --- .../settings/composables/useSettingSearch.test.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/platform/settings/composables/useSettingSearch.test.ts b/src/platform/settings/composables/useSettingSearch.test.ts index 239dec846..799eebed5 100644 --- a/src/platform/settings/composables/useSettingSearch.test.ts +++ b/src/platform/settings/composables/useSettingSearch.test.ts @@ -9,7 +9,16 @@ import { useSettingStore } from '@/platform/settings/settingStore' import type { SettingTreeNode } from '@/platform/settings/settingStore' -import type { SettingParams } from '@/platform/settings/types' + +// Test-specific type for mock settings +interface MockSettingParams { + id: string + name: string + type: string + defaultValue: unknown + category?: string[] + deprecated?: boolean +} // Mock dependencies vi.mock('@/i18n', () => ({ @@ -23,7 +32,7 @@ vi.mock('@/platform/settings/settingStore', () => ({ describe('useSettingSearch', () => { let mockSettingStore: ReturnType - let mockSettings: any + let mockSettings: Record beforeEach(() => { setActivePinia(createPinia()) @@ -76,7 +85,7 @@ describe('useSettingSearch', () => { vi.mocked(useSettingStore).mockReturnValue(mockSettingStore) // Mock getSettingInfo function - vi.mocked(getSettingInfo).mockImplementation((setting: SettingParams) => { + vi.mocked(getSettingInfo).mockImplementation((setting) => { const parts = setting.category || setting.id.split('.') return { category: parts[0] ?? 'Other',