Skip to content

Commit

Permalink
Add test for parseSmartCopilotSettingsSchema
Browse files Browse the repository at this point in the history
  • Loading branch information
kevin-on committed Oct 28, 2024
1 parent bcf5492 commit c629410
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/types/settings.test.ts
Original file line number Diff line number Diff line change
@@ -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,
},
})
})
})
1 change: 1 addition & 0 deletions src/types/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(''),
Expand Down

0 comments on commit c629410

Please sign in to comment.