Files
cc-connect/agent/codex/codex_model_test.go
T
Deeka WongandDeeka Wong 1123c83edb fix(core): share provider model lookup and stabilize tests (#210)
* fix(core): share provider model lookup and stabilize tests

* fix(tests): address PR review follow-ups

---------

Co-authored-by: Deeka Wong <8337659+huangdijia@users.noreply.github.com>
2026-03-19 07:55:48 +08:00

44 lines
948 B
Go

package codex
import (
"testing"
"github.com/chenhg5/cc-connect/core"
)
func TestConfiguredModels_BoundaryConditions(t *testing.T) {
a := &Agent{
providers: []core.ProviderConfig{
{Models: []core.ModelOption{{Name: "first"}}},
{Models: []core.ModelOption{{Name: "second"}}},
},
}
tests := []struct {
name string
activeIdx int
wantNil bool
wantName string
}{
{name: "negative index", activeIdx: -1, wantNil: true},
{name: "out of range", activeIdx: 2, wantNil: true},
{name: "valid index", activeIdx: 1, wantName: "second"},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
a.activeIdx = tt.activeIdx
got := a.configuredModels()
if tt.wantNil {
if got != nil {
t.Fatalf("configuredModels() = %v, want nil", got)
}
return
}
if len(got) != 1 || got[0].Name != tt.wantName {
t.Fatalf("configuredModels() = %v, want %q", got, tt.wantName)
}
})
}
}