import { describe, it, expect } from 'vitest'; import { resolveConverterChain, type ChainPlan } from '../../src/converters/router.js'; describe('router', () => { it('同格式透传', () => { const plan = resolveConverterChain('anthropic', 'anthropic'); expect(plan.passthrough).toBe(true); }); it('anthropic->openai 走 chat 中转', () => { const plan = resolveConverterChain('anthropic', 'openai'); expect(plan.passthrough).toBe(false); expect(plan.source).toBe('anthropic'); expect(plan.provider).toBe('openai'); }); it('responses->response-api 透传(同 Responses 协议,不做 convert)', () => { const plan = resolveConverterChain('responses', 'response-api'); expect(plan.passthrough).toBe(true); }); it('openai->anthropic 走 chat 中转', () => { const plan = resolveConverterChain('openai', 'anthropic'); expect(plan.passthrough).toBe(false); expect(plan.source).toBe('openai'); expect(plan.provider).toBe('anthropic'); }); it('chat->chat 透传', () => { const plan = resolveConverterChain('chat', 'chat'); expect(plan.passthrough).toBe(true); }); it('openai->openai 透传 (response-api 视为 openai 兼容)', () => { const plan = resolveConverterChain('openai', 'openai'); expect(plan.passthrough).toBe(true); }); });