@@ -31,6 +31,7 @@ func TestGetFollowerIDs(t *testing.T) {
31
31
type want struct {
32
32
URLPath string
33
33
ContinuationToken string
34
+ Limit string
34
35
RequestBody []byte
35
36
Response * UserIDsResponse
36
37
Error error
@@ -39,6 +40,7 @@ func TestGetFollowerIDs(t *testing.T) {
39
40
Label string
40
41
GroupID string
41
42
ContinuationToken string
43
+ Limit uint16
42
44
ResponseCode int
43
45
Response []byte
44
46
Want want
@@ -77,6 +79,24 @@ func TestGetFollowerIDs(t *testing.T) {
77
79
},
78
80
},
79
81
},
82
+ {
83
+ Label : "With Limit" ,
84
+ GroupID : "cxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" ,
85
+ Limit : 1 ,
86
+ ResponseCode : 200 ,
87
+ Response : []byte (`{"userIds": ["U0047556f2e40dba2456887320ba7c76d"], "next": "xxxxx"}` ),
88
+ Want : want {
89
+ URLPath : APIEndpointGetFollowerIDs ,
90
+ Limit : "1" ,
91
+ RequestBody : []byte ("" ),
92
+ Response : & UserIDsResponse {
93
+ UserIDs : []string {
94
+ "U0047556f2e40dba2456887320ba7c76d" ,
95
+ },
96
+ Next : "xxxxx" ,
97
+ },
98
+ },
99
+ },
80
100
{
81
101
Label : "Internal server error" ,
82
102
GroupID : "cxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" ,
@@ -108,6 +128,9 @@ func TestGetFollowerIDs(t *testing.T) {
108
128
if start , want := q .Get ("start" ), tc .Want .ContinuationToken ; start != want {
109
129
t .Errorf ("ContinuationToken: %s; want %s" , start , want )
110
130
}
131
+ if limit , want := q .Get ("limit" ), tc .Want .Limit ; limit != want {
132
+ t .Errorf ("Limit: %s; want %s" , limit , want )
133
+ }
111
134
body , err := io .ReadAll (r .Body )
112
135
if err != nil {
113
136
t .Fatal (err )
@@ -135,7 +158,11 @@ func TestGetFollowerIDs(t *testing.T) {
135
158
for i , tc := range testCases {
136
159
currentTestIdx = i
137
160
t .Run (strconv .Itoa (i )+ "/" + tc .Label , func (t * testing.T ) {
138
- res , err := client .GetFollowerIDs (tc .ContinuationToken ).Do ()
161
+ call := client .GetFollowerIDs (tc .ContinuationToken )
162
+ if tc .Limit != 0 {
163
+ call .WithLimit (tc .Limit )
164
+ }
165
+ res , err := call .Do ()
139
166
if tc .Want .Error != nil {
140
167
if ! reflect .DeepEqual (err , tc .Want .Error ) {
141
168
t .Errorf ("Error %v; want %v" , err , tc .Want .Error )
0 commit comments