ultisuite-backend/internal/contacts/discovery/search_settings_test.go
R3D347HR4Y 621b0099d6
Some checks are pending
CI / Go tests (push) Waiting to run
CI / Integration tests (push) Waiting to run
CI / DB migrations (push) Waiting to run
feat(deploy): enhance Nginx configuration and API integration for UltiAI
- Updated .env.example to include new configuration options for the UltiAI branding and API endpoints.
- Enhanced Nginx configuration to support new API routes for the MCP and WebSocket connections.
- Introduced sub-filters for branding adjustments in Nginx responses.
- Added new JavaScript patch for API endpoint adjustments.
- Implemented tests for new API functionalities and improved error handling in the AI gateway.
2026-06-15 00:22:23 +02:00

42 lines
1.1 KiB
Go

package discovery
import (
"testing"
"github.com/ultisuite/ulti-backend/internal/websearch"
)
func TestMergeSearchProviderSecretsPreservesExistingKey(t *testing.T) {
existing := websearch.Settings{
Providers: []websearch.Provider{{
ID: "brave-1", Type: websearch.ProviderBrave, APIKey: "stored-key",
}},
}
patch := websearch.Settings{
Providers: []websearch.Provider{{
ID: "brave-1", Type: websearch.ProviderBrave, APIKey: "",
}},
}
merged := mergeSearchProviderSecrets(existing, patch)
if merged.Providers[0].APIKey != "stored-key" {
t.Fatalf("api_key = %q, want stored-key", merged.Providers[0].APIKey)
}
}
func TestMergeSearchProviderSecretsKeepsNewKey(t *testing.T) {
existing := websearch.Settings{
Providers: []websearch.Provider{{
ID: "brave-1", Type: websearch.ProviderBrave, APIKey: "old-key",
}},
}
patch := websearch.Settings{
Providers: []websearch.Provider{{
ID: "brave-1", Type: websearch.ProviderBrave, APIKey: "new-key",
}},
}
merged := mergeSearchProviderSecrets(existing, patch)
if merged.Providers[0].APIKey != "new-key" {
t.Fatalf("api_key = %q, want new-key", merged.Providers[0].APIKey)
}
}