✅ Update test for pagination
This commit is contained in:
1 parent
5dff86e13d
commit
5bf60ff2f1
26 files changed
+84
-26
No files matched your search
@@ -4,6 +4,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"math"
|
||||
|
||||
"github.com/eat-pray-ai/yutu/pkg"
|
||||
"github.com/eat-pray-ai/yutu/pkg/auth"
|
||||
@@ -190,8 +191,10 @@ func WithIDs(ids []string) Option {
|
||||
|
||||
func WithMaxResults(maxResults int64) Option {
|
||||
return func(c *commentThread) {
|
||||
if maxResults <= 0 {
|
||||
if maxResults < 0 {
|
||||
maxResults = 1
|
||||
} else if maxResults == 0 {
|
||||
maxResults = math.MaxInt64
|
||||
}
|
||||
c.MaxResults = maxResults
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package commentThread
|
||||
|
||||
import (
|
||||
"math"
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
@@ -64,7 +65,7 @@ func TestNewCommentThread(t *testing.T) {
|
||||
},
|
||||
},
|
||||
want: &commentThread{
|
||||
MaxResults: 1,
|
||||
MaxResults: math.MaxInt64,
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user