mirror of
https://github.com/bitechdev/ResolveSpec.git
synced 2026-07-30 06:07:38 +00:00
test(types): add test for ResolveSortColumns with descending order
This commit is contained in:
@@ -26,6 +26,18 @@ func TestResolveSortColumns(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestResolveSortColumnsDesc(t *testing.T) {
|
||||||
|
sort := []SortOption{
|
||||||
|
{Column: PrimaryKeySortColumn, Direction: "desc"},
|
||||||
|
}
|
||||||
|
|
||||||
|
got := ResolveSortColumns(sort, "id")
|
||||||
|
want := []SortOption{{Column: "id", Direction: "desc"}}
|
||||||
|
if !reflect.DeepEqual(got, want) {
|
||||||
|
t.Errorf("ResolveSortColumns() = %v, want %v", got, want)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestResolveSortColumnsEmptyPK(t *testing.T) {
|
func TestResolveSortColumnsEmptyPK(t *testing.T) {
|
||||||
sort := []SortOption{
|
sort := []SortOption{
|
||||||
{Column: PrimaryKeySortColumn, Direction: "asc"},
|
{Column: PrimaryKeySortColumn, Direction: "asc"},
|
||||||
|
|||||||
Reference in New Issue
Block a user