(t *testing.T)
| 21 | } |
| 22 | |
| 23 | func TestResolve_priority(t *testing.T) { |
| 24 | // Default: no flag, no env, nil config -> Claude |
| 25 | got := mustResolve(t, "", "", nil) |
| 26 | if got.Name() != "Claude" { |
| 27 | t.Errorf("Resolve(_, _, nil) name = %q, want Claude", got.Name()) |
| 28 | } |
| 29 | if got.CLIPath() != "claude" { |
| 30 | t.Errorf("Resolve(_, _, nil) CLIPath = %q, want claude", got.CLIPath()) |
| 31 | } |
| 32 | |
| 33 | // Flag overrides everything |
| 34 | got = mustResolve(t, "codex", "", nil) |
| 35 | if got.Name() != "Codex" { |
| 36 | t.Errorf("Resolve(codex, _, nil) name = %q, want Codex", got.Name()) |
| 37 | } |
| 38 | |
| 39 | // Config only (no flag, no env) |
| 40 | cfg := &config.Config{} |
| 41 | cfg.Agent.Provider = "codex" |
| 42 | cfg.Agent.CLIPath = "/usr/local/bin/codex" |
| 43 | got = mustResolve(t, "", "", cfg) |
| 44 | if got.Name() != "Codex" { |
| 45 | t.Errorf("Resolve(_, _, config codex) name = %q, want Codex", got.Name()) |
| 46 | } |
| 47 | if got.CLIPath() != "/usr/local/bin/codex" { |
| 48 | t.Errorf("Resolve(_, _, config) CLIPath = %q, want /usr/local/bin/codex", got.CLIPath()) |
| 49 | } |
| 50 | |
| 51 | // Flag overrides config |
| 52 | got = mustResolve(t, "claude", "", cfg) |
| 53 | if got.Name() != "Claude" { |
| 54 | t.Errorf("Resolve(claude, _, config codex) name = %q, want Claude", got.Name()) |
| 55 | } |
| 56 | // flag path overrides config path |
| 57 | got = mustResolve(t, "codex", "/opt/codex", cfg) |
| 58 | if got.CLIPath() != "/opt/codex" { |
| 59 | t.Errorf("Resolve(codex, /opt/codex, cfg) CLIPath = %q, want /opt/codex", got.CLIPath()) |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | func TestResolve_env(t *testing.T) { |
| 64 | const keyAgent = "CHIEF_AGENT" |
nothing calls this directly
no test coverage detected