55 lines
1.3 KiB
Go
55 lines
1.3 KiB
Go
package adapters
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"google.golang.org/protobuf/types/known/structpb"
|
|
)
|
|
|
|
func TestCLIConfFromStruct_ProfileRuntimeOptions(t *testing.T) {
|
|
st, err := structpb.NewStruct(map[string]any{
|
|
"profiles": map[string]any{
|
|
"claude": map[string]any{
|
|
"command": "claude",
|
|
"args": []any{},
|
|
"env": []any{},
|
|
"persistent": true,
|
|
"terminal": true,
|
|
"response_idle_timeout_ms": float64(1500),
|
|
"startup_idle_timeout_ms": float64(300),
|
|
},
|
|
},
|
|
})
|
|
if err != nil {
|
|
t.Fatalf("structpb: %v", err)
|
|
}
|
|
|
|
cfg := cliConfFromStruct(st)
|
|
|
|
prof, ok := cfg.Profiles["claude"]
|
|
if !ok {
|
|
t.Fatal("expected claude profile")
|
|
}
|
|
if prof.Command != "claude" {
|
|
t.Fatalf("command: got %q", prof.Command)
|
|
}
|
|
if !prof.Persistent {
|
|
t.Fatal("expected persistent=true")
|
|
}
|
|
if !prof.Terminal {
|
|
t.Fatal("expected terminal=true")
|
|
}
|
|
if prof.ResponseIdleTimeoutMS != 1500 {
|
|
t.Fatalf("response_idle_timeout_ms: got %d", prof.ResponseIdleTimeoutMS)
|
|
}
|
|
if prof.StartupIdleTimeoutMS != 300 {
|
|
t.Fatalf("startup_idle_timeout_ms: got %d", prof.StartupIdleTimeoutMS)
|
|
}
|
|
}
|
|
|
|
func TestCLIConfFromStruct_NilSettings(t *testing.T) {
|
|
cfg := cliConfFromStruct(nil)
|
|
if cfg.Enabled {
|
|
t.Fatal("expected enabled=false for nil settings")
|
|
}
|
|
}
|