Skip to content

Commit

Permalink
add test for pagination function
Browse files Browse the repository at this point in the history
  • Loading branch information
SimoneDutto committed Sep 4, 2024
1 parent 5ded876 commit cf49872
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions internal/common/pagination/pagination_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,18 @@ func TestCreatePagination(t *testing.T) {
}
}

// test the requested size is 1 more than then page size.
func TestCreatePaginationWithoutTotal(t *testing.T) {
c := qt.New(t)
pPage := utils.IntToPointer(0)
pSize := utils.IntToPointer(10)
page, size, pag := pagination.CreatePaginationWithoutTotal(pSize, pPage)
c.Assert(page, qt.Equals, 0)
c.Assert(pag.Limit(), qt.Equals, 11)
c.Assert(pag.Offset(), qt.Equals, 0)
c.Assert(size, qt.Equals, 11)
}

func TestTokenFilter(t *testing.T) {
testToken := "test-token"
testCases := []struct {
Expand Down

0 comments on commit cf49872

Please sign in to comment.