ultisuite-backend/internal/api/admin/sort_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

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)
}
}