import { describe, expect, it } from "@effect/vitest"; import { ProviderInstanceId, type ModelSelection } from "@t3tools/contracts"; import { compileClaudeModelSelection } from "./claudeModelOptions.ts"; const selection = ( model: string, options: NonNullable, ): ModelSelection => ({ instanceId: ProviderInstanceId.make("claude_test"), model, options, }); describe("compileClaudeModelSelection", () => { it("compiles context, effort, and settings together", () => { expect( compileClaudeModelSelection( selection("claude-fable-5", [ { id: "contextWindow", value: "1m" }, { id: "effort", value: "ultracode" }, ]), ), ).toMatchObject({ apiModelId: "claude-fable-5[1m]", effort: "xhigh", settings: { ultracode: true }, }); }); it("compiles fast mode only for models that expose it", () => { expect( compileClaudeModelSelection(selection("claude-opus-4-6", [{ id: "fastMode", value: true }])) .settings, ).toEqual({ fastMode: true }); expect( compileClaudeModelSelection(selection("claude-opus-4-6", [{ id: "fastMode", value: false }])) .settings, ).toEqual({ fastMode: false }); }); it("uses the model default SDK effort alongside prompt-injected effort", () => { expect( compileClaudeModelSelection( selection("claude-sonnet-4-6", [{ id: "effort", value: "ultrathink" }]), ), ).toMatchObject({ effort: "high", promptEffort: "ultrathink" }); }); it("compiles the thinking toggle for models that expose it", () => { expect( compileClaudeModelSelection(selection("claude-haiku-4-5", [{ id: "thinking", value: false }])) .settings, ).toEqual({ alwaysThinkingEnabled: false }); }); });