package ollama import "testing" func TestNew(t *testing.T) { t.Run("local mode picks default local URL", func(t *testing.T) { p := New("", "") if p == nil { t.Fatal("New returned nil") } if p.baseURL != DefaultLocalBaseURL { t.Errorf("baseURL: want %q, got %q", DefaultLocalBaseURL, p.baseURL) } if p.apiKey != "" { t.Errorf("apiKey: want empty, got %q", p.apiKey) } }) t.Run("cloud mode (apiKey set) picks cloud URL", func(t *testing.T) { p := New("test-key", "") if p.baseURL != DefaultCloudBaseURL { t.Errorf("baseURL: want %q, got %q", DefaultCloudBaseURL, p.baseURL) } if p.apiKey != "test-key" { t.Errorf("apiKey: want %q, got %q", "test-key", p.apiKey) } }) t.Run("explicit baseURL is preserved", func(t *testing.T) { p := New("k", "http://example.test:9999") if p.baseURL != "http://example.test:9999" { t.Errorf("baseURL not preserved, got %q", p.baseURL) } }) }