mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2025-06-18 10:06:26 +00:00
Add more unit tests
This commit is contained in:
27
backend/internal/model/pageinfo_test.go
Normal file
27
backend/internal/model/pageinfo_test.go
Normal file
@ -0,0 +1,27 @@
|
||||
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})
|
||||
}
|
Reference in New Issue
Block a user