2026-03-14 13:46:32 +09:00
|
|
|
import { describe, expect, test } from "bun:test"
|
|
|
|
|
|
|
|
|
|
import { validateNonTuiArgs } from "./install-validators"
|
|
|
|
|
import type { InstallArgs } from "./types"
|
|
|
|
|
|
|
|
|
|
function createArgs(overrides: Partial<InstallArgs> = {}): InstallArgs {
|
|
|
|
|
return {
|
|
|
|
|
tui: false,
|
|
|
|
|
claude: "no",
|
|
|
|
|
openai: "no",
|
|
|
|
|
gemini: "no",
|
|
|
|
|
copilot: "no",
|
2026-05-25 22:25:09 +09:00
|
|
|
codex: "no",
|
2026-03-14 13:46:32 +09:00
|
|
|
opencodeZen: "no",
|
|
|
|
|
zaiCodingPlan: "no",
|
|
|
|
|
kimiForCoding: "no",
|
|
|
|
|
opencodeGo: "no",
|
|
|
|
|
skipAuth: false,
|
|
|
|
|
...overrides,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
describe("validateNonTuiArgs", () => {
|
|
|
|
|
test("rejects invalid --opencode-go values", () => {
|
|
|
|
|
// #given
|
|
|
|
|
const args = createArgs({ opencodeGo: "maybe" as InstallArgs["opencodeGo"] })
|
|
|
|
|
|
|
|
|
|
// #when
|
|
|
|
|
const result = validateNonTuiArgs(args)
|
|
|
|
|
|
|
|
|
|
// #then
|
|
|
|
|
expect(result.valid).toBe(false)
|
|
|
|
|
expect(result.errors).toContain("Invalid --opencode-go value: maybe (expected: no, yes)")
|
|
|
|
|
})
|
|
|
|
|
})
|