mirror of
https://github.com/lukaszraczylo/mcp-captcharesolver.git
synced 2026-10-20 01:27:53 +00:00
feat(llm): provider factory with per-provider default base URLs
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
package llm
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/lukaszraczylo/captcha-solver-mcp/internal/config"
|
||||
)
|
||||
|
||||
func TestNew(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
provider string
|
||||
wantBase string
|
||||
wantErr bool
|
||||
}{
|
||||
{"anthropic default base", "anthropic", "https://api.anthropic.com", false},
|
||||
{"openai default base", "openai", "https://api.openai.com", false},
|
||||
{"compatible needs base", "openai-compatible", "", true},
|
||||
{"unknown", "zzz", "", true},
|
||||
}
|
||||
for _, tc := range tests {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
cfg := config.Config{Provider: tc.provider, APIKey: "k", Model: "m"}
|
||||
c, err := New(cfg)
|
||||
if tc.wantErr {
|
||||
if err == nil {
|
||||
t.Fatal("want error")
|
||||
}
|
||||
return
|
||||
}
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected err: %v", err)
|
||||
}
|
||||
if c == nil {
|
||||
t.Fatal("nil client")
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user