20 lines
908 B
TypeScript
20 lines
908 B
TypeScript
import { describe, expect, test } from "bun:test"
|
|
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",
|
|
)
|
|
})
|
|
})
|