@@ -0,0 +1,26 @@
|
||||
package web
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestEmptyScopedPage(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
hasIdentifier bool
|
||||
totalCount int64
|
||||
itemCount int
|
||||
want bool
|
||||
}{
|
||||
{name: "missing detail", hasIdentifier: true, want: true},
|
||||
{name: "empty aggregate page", hasIdentifier: false, want: false},
|
||||
{name: "has total", hasIdentifier: true, totalCount: 1, want: false},
|
||||
{name: "has item", hasIdentifier: true, itemCount: 1, want: false},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
if got := emptyScopedPage(tt.hasIdentifier, tt.totalCount, tt.itemCount); got != tt.want {
|
||||
t.Fatalf("emptyScopedPage(%v, %d, %d) = %v, want %v", tt.hasIdentifier, tt.totalCount, tt.itemCount, got, tt.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user