opencode-cursor-agent/internal/config/config_test.go

63 lines
1.4 KiB
Go

package config_test
import (
"testing"
"cursor-api-proxy/internal/config"
)
func TestConfigToBridgeConfig(t *testing.T) {
cfg := config.Config{}
bc := cfg.ToBridgeConfig()
if bc.Host != "" {
t.Errorf("Host = %q, want empty", bc.Host)
}
if bc.Mode != "ask" {
t.Errorf("Mode = %q, want ask", bc.Mode)
}
}
func TestConfigToBridgeConfigWithValues(t *testing.T) {
cfg := config.Config{
AgentBin: "cursor",
DefaultModel: "claude-3.5-sonnet",
Provider: "cursor",
TimeoutMs: 300000,
Force: true,
ApproveMcps: true,
StrictModel: true,
Workspace: "/tmp/test",
ChatOnlyWorkspace: true,
Verbose: true,
GeminiAccountDir: "/tmp/gemini",
GeminiBrowserVisible: true,
GeminiMaxSessions: 5,
}
bc := cfg.ToBridgeConfig()
if bc.AgentBin != "cursor" {
t.Errorf("AgentBin = %q, want cursor", bc.AgentBin)
}
if bc.DefaultModel != "claude-3.5-sonnet" {
t.Errorf("DefaultModel = %q, want claude-3.5-sonnet", bc.DefaultModel)
}
if bc.TimeoutMs != 300000 {
t.Errorf("TimeoutMs = %d, want 300000", bc.TimeoutMs)
}
if !bc.Force {
t.Error("Force should be true")
}
if !bc.ApproveMcps {
t.Error("ApproveMcps should be true")
}
if !bc.StrictModel {
t.Error("StrictModel should be true")
}
if bc.Mode != "ask" {
t.Errorf("Mode = %q, want ask", bc.Mode)
}
}