dal/pkg/builder/convert_sort_test.go

25 lines
415 B
Go
Raw Normal View History

package builder
import (
"testing"
)
func TestConvertSort(t *testing.T) {
ctx := CommonDialect{
TableAlias: "t",
FieldName: "test",
}
result, err := convertSort(ctx, Map{
"a": -1,
"c": "desc",
"b": 1,
"d": nil,
})
if err != nil {
t.Error(err)
}
if result != `ORDER BY t.a DESC, t.b ASC, t.c DESC, t.d` {
t.Errorf("Expected ORDER BY t.a DESC, t.b ASC, t.c DESC, t.d, got %s", result)
}
}