From f7fcfa623e670dc533bb378912829c73a3593e63 Mon Sep 17 00:00:00 2001 From: s Date: Mon, 3 Nov 2025 21:17:12 -0500 Subject: hi --- internal/client/client_test.go | 46 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 internal/client/client_test.go (limited to 'internal/client/client_test.go') diff --git a/internal/client/client_test.go b/internal/client/client_test.go new file mode 100644 index 0000000..9bf453d --- /dev/null +++ b/internal/client/client_test.go @@ -0,0 +1,46 @@ +package client + +import ( + "dborg/internal/config" + "testing" + "time" +) + +func TestNewClient(t *testing.T) { + tests := []struct { + name string + config *config.Config + wantErr bool + }{ + { + name: "valid config", + config: &config.Config{ + APIKey: "test-key", + BaseURL: "https://db.org.ai", + Timeout: 30 * time.Second, + MaxRetries: 3, + UserAgent: "test-agent", + }, + wantErr: false, + }, + { + name: "missing API key", + config: &config.Config{ + BaseURL: "https://db.org.ai", + Timeout: 30 * time.Second, + MaxRetries: 3, + UserAgent: "test-agent", + }, + wantErr: true, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + _, err := New(tt.config) + if (err != nil) != tt.wantErr { + t.Errorf("New() error = %v, wantErr %v", err, tt.wantErr) + } + }) + } +} -- cgit v1.2.3