* Tests for the batch processing utility. * * Mocks the Anthropic SDK batch methods since we're testing our * orchestration logic (submission, polling, result collection), * not the Anthropic API itself.
(overrides: {
create?: ReturnType<typeof vi.fn>;
retrieve?: ReturnType<typeof vi.fn>;
results?: ReturnType<typeof vi.fn>;
} = {})
| 12 | */ |
| 13 | |
| 14 | function makeClient(overrides: { |
| 15 | create?: ReturnType<typeof vi.fn>; |
| 16 | retrieve?: ReturnType<typeof vi.fn>; |
| 17 | results?: ReturnType<typeof vi.fn>; |
| 18 | } = {}) { |
| 19 | return { |
| 20 | messages: { |
| 21 | batches: { |
| 22 | create: overrides.create ?? vi.fn(), |
| 23 | retrieve: overrides.retrieve ?? vi.fn(), |
| 24 | results: overrides.results ?? vi.fn(), |
| 25 | cancel: vi.fn(), |
| 26 | }, |
| 27 | }, |
| 28 | } as unknown as Anthropic; |
| 29 | } |
| 30 | |
| 31 | function makeSucceededEntry(customId: string, text: string) { |
| 32 | return { |