Skip to content

test: Native Anthropic pass-through — feature coverage tests #44

@HXYerror

Description

@HXYerror

Part of #38. Depends on #39, #40, #41.

Goal

Test coverage for the native Anthropic pass-through path added in #39#41.

Tasks

  • tests/messages-native-dispatch.test.ts — unit tests for the dispatch logic in feat: Route dispatch — detect native-capable models, branch to pass-through #40:

    • claude-sonnet-4.5 → native path
    • claude-sonnet-4 → translation path
    • gpt-4o → translation path (no change)
    • Alias "sonnet-4.5" → resolves → native path
  • tests/messages-native-passthrough.test.ts — integration tests (mock upstream):

    • Basic chat: response shape is Anthropic {type:"message", content:[...]} (NOT OpenAI {choices:[...]})
    • Thinking block: response includes {type:"thinking", thinking:"...", signature:"..."}
    • Tool use: response includes {type:"tool_use", name:"...", input:{...}}
    • Streaming: SSE events are message_start / content_block_* / message_delta / message_stop
    • Multi-turn with thinking: echoed signature in input is forwarded byte-exact to upstream mock
  • tests/anthropic-types.test.ts — verify AnthropicThinkingBlock has signature? field, and usage shape includes cache_creation

  • Regression: existing tests/anthropic-request.test.ts and tests/anthropic-response.test.ts still pass (translation path unchanged)

Acceptance criteria

  • bun test passes with native path tests
  • Mock upstream confirms no translation happens for native-path models (request body sent to mock is unchanged Anthropic JSON)
  • Mock upstream confirms translation happens for legacy-path models (request body is OpenAI JSON)

Metadata

Metadata

Assignees

No one assigned

    Labels

    anthropicAnthropic Messages API compatibilitytestTests

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions