- 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.
42 lines
1.1 KiB
Go
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)
|
|
}
|
|
}
|