dal/pkg/builder/convert_sort_test.go
Anton Nesterov 05f155ecc0
[wip] builder
Signed-off-by: Anton Nesterov <anton@demiurg.io>
2024-08-10 00:33:10 +02:00

25 lines
415 B
Go

package builder
import (
"testing"
)
func TestConvertSort(t *testing.T) {
ctx := SQLiteContext{
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)
}
}