- 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.
32 lines
762 B
Go
32 lines
762 B
Go
package admin
|
|
|
|
import "testing"
|
|
|
|
func TestBuildUserOrderBy(t *testing.T) {
|
|
tests := []struct {
|
|
sort string
|
|
want string
|
|
}{
|
|
{"", "ORDER BY created_at DESC"},
|
|
{"-email", "ORDER BY LOWER(email) DESC"},
|
|
{"name", "ORDER BY LOWER(name) ASC"},
|
|
{"invalid", "ORDER BY created_at DESC"},
|
|
}
|
|
for _, tt := range tests {
|
|
if got := buildUserOrderBy(tt.sort); got != tt.want {
|
|
t.Fatalf("buildUserOrderBy(%q) = %q, want %q", tt.sort, got, tt.want)
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestParseSortField(t *testing.T) {
|
|
field, desc := parseSortField("-created_at")
|
|
if field != "created_at" || !desc {
|
|
t.Fatalf("parseSortField = %q %v", field, desc)
|
|
}
|
|
field, desc = parseSortField("email")
|
|
if field != "email" || desc {
|
|
t.Fatalf("parseSortField = %q %v", field, desc)
|
|
}
|
|
}
|