From c6294107edc575088aeb5916a975b4eea91d5576 Mon Sep 17 00:00:00 2001 From: Kwanghyun On Date: Mon, 28 Oct 2024 15:24:57 +0900 Subject: [PATCH] Add test for parseSmartCopilotSettingsSchema --- src/types/settings.test.ts | 22 ++++++++++++++++++++++ src/types/settings.ts | 1 + 2 files changed, 23 insertions(+) create mode 100644 src/types/settings.test.ts diff --git a/src/types/settings.test.ts b/src/types/settings.test.ts new file mode 100644 index 0000000..5790425 --- /dev/null +++ b/src/types/settings.test.ts @@ -0,0 +1,22 @@ +import { parseSmartCopilotSettings } from './settings' + +describe('parseSmartCopilotSettings', () => { + it('should return default values for empty input', () => { + const result = parseSmartCopilotSettings({}) + expect(result).toEqual({ + openAIApiKey: '', + groqApiKey: '', + anthropicApiKey: '', + ollamaBaseUrl: '', + chatModel: 'claude-3-5-sonnet-latest', + applyModel: 'gpt-4o-mini', + embeddingModel: 'text-embedding-3-small', + ragOptions: { + chunkSize: 1000, + thresholdTokens: 8192, + minSimilarity: 0.0, + limit: 10, + }, + }) + }) +}) diff --git a/src/types/settings.ts b/src/types/settings.ts index 4f959b5..b774af3 100644 --- a/src/types/settings.ts +++ b/src/types/settings.ts @@ -16,6 +16,7 @@ const embeddingModelSchema = z.enum( EMBEDDING_MODEL_OPTIONS.map((opt) => opt.value) as [string, ...string[]], ) +// Update settings.test.ts after changing this schema const smartCopilotSettingsSchema = z.object({ openAIApiKey: z.string().catch(''), groqApiKey: z.string().catch(''),