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

63 lines
1.4 KiB
Go
Raw Normal View History

2026-03-30 14:09:15 +00:00
package config_test
import (
"testing"
"cursor-api-proxy/internal/config"
2026-03-30 14:09:15 +00:00
)
func TestConfigToBridgeConfig(t *testing.T) {
cfg := config.Config{}
2026-03-30 14:09:15 +00:00
bc := cfg.ToBridgeConfig()
if bc.Host != "" {
t.Errorf("Host = %q, want empty", bc.Host)
2026-03-30 14:09:15 +00:00
}
if bc.Mode != "ask" {
t.Errorf("Mode = %q, want ask", bc.Mode)
2026-03-30 14:09:15 +00:00
}
}
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,
2026-03-30 14:09:15 +00:00
}
bc := cfg.ToBridgeConfig()
if bc.AgentBin != "cursor" {
t.Errorf("AgentBin = %q, want cursor", bc.AgentBin)
2026-03-30 14:09:15 +00:00
}
if bc.DefaultModel != "claude-3.5-sonnet" {
t.Errorf("DefaultModel = %q, want claude-3.5-sonnet", bc.DefaultModel)
2026-03-30 14:09:15 +00:00
}
if bc.TimeoutMs != 300000 {
t.Errorf("TimeoutMs = %d, want 300000", bc.TimeoutMs)
2026-03-30 14:09:15 +00:00
}
if !bc.Force {
2026-03-30 14:09:15 +00:00
t.Error("Force should be true")
}
if !bc.ApproveMcps {
2026-03-30 14:09:15 +00:00
t.Error("ApproveMcps should be true")
}
if !bc.StrictModel {
t.Error("StrictModel should be true")
2026-03-30 14:09:15 +00:00
}
if bc.Mode != "ask" {
t.Errorf("Mode = %q, want ask", bc.Mode)
2026-03-30 14:09:15 +00:00
}
}