Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
27 lines
774 B
Go
27 lines
774 B
Go
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)
|
|
}
|
|
})
|
|
}
|
|
}
|