- 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.
50 lines
1.1 KiB
Go
50 lines
1.1 KiB
Go
package admin
|
|
|
|
import "testing"
|
|
|
|
func TestMergeOrgPluginsAddsMissingDefaults(t *testing.T) {
|
|
defaults := defaultOrgPolicy()["plugins"].([]any)
|
|
stored := []any{
|
|
map[string]any{
|
|
"id": "mail-automation",
|
|
"name": "Old name",
|
|
"description": "Old description",
|
|
"enabled": false,
|
|
"version": "0.9.0",
|
|
},
|
|
}
|
|
|
|
merged := mergeOrgPlugins(defaults, stored)
|
|
if len(merged) != len(defaults) {
|
|
t.Fatalf("len(merged) = %d, want %d", len(merged), len(defaults))
|
|
}
|
|
|
|
first, ok := merged[0].(map[string]any)
|
|
if !ok {
|
|
t.Fatalf("first plugin is not a map")
|
|
}
|
|
if first["enabled"] != false {
|
|
t.Fatalf("enabled = %v, want false", first["enabled"])
|
|
}
|
|
if first["version"] != "0.9.0" {
|
|
t.Fatalf("version = %v, want stored override", first["version"])
|
|
}
|
|
|
|
var hasRichtext bool
|
|
for _, item := range merged {
|
|
plugin, ok := item.(map[string]any)
|
|
if !ok {
|
|
continue
|
|
}
|
|
if plugin["id"] == "richtext-editor" {
|
|
hasRichtext = true
|
|
if plugin["enabled"] != true {
|
|
t.Fatalf("richtext-editor enabled = %v, want true", plugin["enabled"])
|
|
}
|
|
}
|
|
}
|
|
if !hasRichtext {
|
|
t.Fatal("expected richtext-editor from defaults")
|
|
}
|
|
}
|