nginx-proxy-manager-zh/backend/internal/model/pageinfo_test.go
2023-07-28 16:10:44 +10:00

28 lines
453 B
Go

package model
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestPageInfoGetSort(t *testing.T) {
t.Parallel()
pi := PageInfo{}
def := Sort{
Field: "name",
Direction: "asc",
}
defined := Sort{
Field: "nickname",
Direction: "desc",
}
// default
sort := pi.GetSort(def)
assert.Equal(t, sort, []Sort{def})
// defined
pi.Sort = []Sort{defined}
sort = pi.GetSort(def)
assert.Equal(t, sort, []Sort{defined})
}