2026-04-09 14:19:17 +09:00
|
|
|
import { describe, expect, mock, test } from "bun:test"
|
2026-03-03 00:31:12 +09:00
|
|
|
import { resolveModelPipeline } from "./model-resolution-pipeline"
|
|
|
|
|
|
2026-04-09 14:19:17 +09:00
|
|
|
// Force test-runner isolation: files that import mock.module are auto-detected
|
|
|
|
|
// by run-ci-tests.ts and executed in their own bun process so they cannot be
|
|
|
|
|
// contaminated by (or contaminate) mock.module calls in other test files.
|
|
|
|
|
mock.module("./logger", () => ({
|
|
|
|
|
log: () => {},
|
|
|
|
|
}))
|
|
|
|
|
|
2026-03-03 00:31:12 +09:00
|
|
|
describe("resolveModelPipeline", () => {
|
|
|
|
|
test("does not return unused explicit user config metadata in override result", () => {
|
|
|
|
|
// given
|
|
|
|
|
const result = resolveModelPipeline({
|
|
|
|
|
intent: {
|
|
|
|
|
userModel: "openai/gpt-5.3-codex",
|
|
|
|
|
},
|
|
|
|
|
constraints: {
|
|
|
|
|
availableModels: new Set<string>(),
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
// when
|
|
|
|
|
const hasExplicitUserConfigField = result
|
|
|
|
|
? Object.prototype.hasOwnProperty.call(result, "explicitUserConfig")
|
|
|
|
|
: false
|
|
|
|
|
|
|
|
|
|
// then
|
|
|
|
|
expect(result).toEqual({ model: "openai/gpt-5.3-codex", provenance: "override" })
|
|
|
|
|
expect(hasExplicitUserConfigField).toBe(false)
|
|
|
|
|
})
|
|
|
|
|
})
|