mirror of
https://github.com/eduardolat/pgbackweb.git
synced 2026-01-24 13:38:26 -06:00
Delete unused function
This commit is contained in:
@@ -1,14 +0,0 @@
|
||||
package paginateutil
|
||||
|
||||
// HasNextPage returns true if there are more pages to show.
|
||||
func HasNextPage(
|
||||
totalItems int,
|
||||
limit int,
|
||||
offset int,
|
||||
) bool {
|
||||
if totalItems <= 0 {
|
||||
return false
|
||||
}
|
||||
|
||||
return totalItems > offset+limit
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
package paginateutil
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestHasNextPage(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
totalItems int
|
||||
limit int
|
||||
offset int
|
||||
want bool
|
||||
}{
|
||||
{
|
||||
name: "No items",
|
||||
totalItems: 0,
|
||||
limit: 10,
|
||||
offset: 0,
|
||||
want: false,
|
||||
},
|
||||
{
|
||||
name: "Exact number of items as limit",
|
||||
totalItems: 10,
|
||||
limit: 10,
|
||||
offset: 0,
|
||||
want: false,
|
||||
},
|
||||
{
|
||||
name: "More items than limit",
|
||||
totalItems: 15,
|
||||
limit: 10,
|
||||
offset: 0,
|
||||
want: true,
|
||||
},
|
||||
{
|
||||
name: "No more items beyond current page",
|
||||
totalItems: 20,
|
||||
limit: 10,
|
||||
offset: 10,
|
||||
want: false,
|
||||
},
|
||||
{
|
||||
name: "More items beyond current page",
|
||||
totalItems: 25,
|
||||
limit: 10,
|
||||
offset: 10,
|
||||
want: true,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
got := HasNextPage(tt.totalItems, tt.limit, tt.offset)
|
||||
assert.Equal(t, tt.want, got)
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user