summaryrefslogtreecommitdiffstats
path: root/internal/client/client_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/client/client_test.go')
-rw-r--r--internal/client/client_test.go42
1 files changed, 42 insertions, 0 deletions
diff --git a/internal/client/client_test.go b/internal/client/client_test.go
index 31939fb..fb21755 100644
--- a/internal/client/client_test.go
+++ b/internal/client/client_test.go
@@ -44,3 +44,45 @@ func TestNewClient(t *testing.T) {
})
}
}
+
+func TestNewUnauthenticatedClient(t *testing.T) {
+ tests := []struct {
+ name string
+ config *config.Config
+ wantErr bool
+ }{
+ {
+ name: "config with API key",
+ config: &config.Config{
+ APIKey: "test-key",
+ BaseURL: "https://db.org.ai",
+ Timeout: 30 * time.Second,
+ MaxRetries: 3,
+ UserAgent: "test-agent",
+ },
+ wantErr: false,
+ },
+ {
+ name: "config without API key",
+ config: &config.Config{
+ BaseURL: "https://db.org.ai",
+ Timeout: 30 * time.Second,
+ MaxRetries: 3,
+ UserAgent: "test-agent",
+ },
+ wantErr: false,
+ },
+ }
+
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ c, err := NewUnauthenticated(tt.config)
+ if (err != nil) != tt.wantErr {
+ t.Errorf("NewUnauthenticated() error = %v, wantErr %v", err, tt.wantErr)
+ }
+ if c == nil && !tt.wantErr {
+ t.Error("NewUnauthenticated() returned nil client")
+ }
+ })
+ }
+}