fix(tui): include variant in model switch notice (#34856)

Co-authored-by: Aiden Cline <aidenpcline@gmail.com>
This commit is contained in:
opencode-agent[bot] 2026-07-02 00:17:18 -05:00 committed by GitHub
commit cfd35c9354
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 22 additions and 3 deletions

View file

@ -1,9 +1,20 @@
import { describe, expect, test } from "bun:test"
import { parse } from "../../src/util/model"
import { formatRef, parse, switchLabel } from "../../src/util/model"
describe("util.model", () => {
test("splits provider from a nested model identifier", () => {
expect(parse("provider/org/model")).toEqual({ providerID: "provider", modelID: "org/model" })
expect(parse("invalid")).toEqual({ providerID: "invalid", modelID: "" })
})
test("includes the selected variant in model refs", () => {
expect(formatRef({ providerID: "anthropic", id: "sonnet", variant: "thinking" })).toBe("anthropic/sonnet/thinking")
expect(formatRef({ providerID: "anthropic", id: "sonnet" })).toBe("anthropic/sonnet")
})
test("includes the selected variant in model switch notices", () => {
expect(switchLabel({ providerID: "anthropic", id: "sonnet", variant: "thinking" })).toBe(
"Switched model to anthropic/sonnet/thinking",
)
})
})