| 1 | import { describe, expect, it, vi } from 'vitest' |
| 2 | |
| 3 | import { CreateContentGenerationTaskSchema } from './agent.dto' |
| 4 | |
| 5 | vi.mock('../../config', () => ({ |
| 6 | config: { |
| 7 | agent: { |
| 8 | models: ['claude-opus-4-6', 'deepseek-anthropic-chat'], |
| 9 | defaultModel: 'claude-opus-4-6', |
| 10 | }, |
| 11 | }, |
| 12 | })) |
| 13 | |
| 14 | describe('createContentGenerationTaskSchema', () => { |
| 15 | it('defaults to the configured Claude model', () => { |
| 16 | const task = CreateContentGenerationTaskSchema.parse({ |
| 17 | prompt: 'Create a video script', |
| 18 | }) |
| 19 | |
| 20 | expect(task.model).toBe('claude-opus-4-6') |
| 21 | }) |
| 22 | |
| 23 | it('accepts a configured Anthropic-compatible third-party model', () => { |
| 24 | const task = CreateContentGenerationTaskSchema.parse({ |
| 25 | prompt: 'Create a video script', |
| 26 | model: 'deepseek-anthropic-chat', |
| 27 | }) |
| 28 | |
| 29 | expect(task.model).toBe('deepseek-anthropic-chat') |
| 30 | }) |
| 31 | |
| 32 | it('rejects models outside config.agent.models', () => { |
| 33 | const result = CreateContentGenerationTaskSchema.safeParse({ |
| 34 | prompt: 'Create a video script', |
| 35 | model: 'missing-model', |
| 36 | }) |
| 37 | |
| 38 | expect(result.success).toBe(false) |
| 39 | }) |
| 40 | }) |
| 41 |