@@ -163,21 +163,11 @@ func Test_ListDiscussions(t *testing.T) {
163
163
}
164
164
require .NoError (t ,err )
165
165
166
- // Debug: print the actual response
167
- t .Logf ("Actual response text: %q" ,text )
168
-
169
166
// Parse the structured response with pagination info
170
- var response struct {
171
- Discussions []* github.Discussion `json:"discussions"`
172
- PageInfo struct {
173
- HasNextPage bool `json:"hasNextPage"`
174
- EndCursor string `json:"endCursor"`
175
- }`json:"pageInfo"`
176
- }
177
- err = json .Unmarshal ([]byte (text ),& response )
167
+ var returnedDiscussions []* github.Discussion
168
+ err = json .Unmarshal ([]byte (text ),& returnedDiscussions )
178
169
require .NoError (t ,err )
179
170
180
- returnedDiscussions := response .Discussions
181
171
assert .Len (t ,returnedDiscussions ,tc .expectedCount ,"Expected %d discussions, got %d" ,tc .expectedCount ,len (returnedDiscussions ))
182
172
183
173
// Verify that all returned discussions have a category if filtered
@@ -338,18 +328,14 @@ func Test_GetDiscussionComments(t *testing.T) {
338
328
339
329
textContent := getTextResult (t ,result )
340
330
341
- var response struct {
342
- Comments []* github.IssueComment `json:"comments"`
343
- PageInfo map [string ]interface {}`json:"pageInfo"`
344
- }
345
- err = json .Unmarshal ([]byte (textContent .Text ),& response )
331
+ var comments []* github.IssueComment
332
+ err = json .Unmarshal ([]byte (textContent .Text ),& comments )
346
333
require .NoError (t ,err )
347
- assert .Len (t ,response . Comments ,2 )
334
+ assert .Len (t ,comments ,2 )
348
335
expectedBodies := []string {"This is the first comment" ,"This is the second comment" }
349
- for i ,comment := range response . Comments {
336
+ for i ,comment := range comments {
350
337
assert .Equal (t ,expectedBodies [i ],* comment .Body )
351
338
}
352
- assert .Equal (t ,false ,response .PageInfo ["hasNextPage" ])
353
339
}
354
340
355
341
func Test_ListDiscussionCategories (t * testing.T ) {
@@ -394,15 +380,11 @@ func Test_ListDiscussionCategories(t *testing.T) {
394
380
require .NoError (t ,err )
395
381
396
382
text := getTextResult (t ,result ).Text
397
- var response struct {
398
- Categories []map [string ]string `json:"categories"`
399
- PageInfo map [string ]interface {}`json:"pageInfo"`
400
- }
401
- require .NoError (t ,json .Unmarshal ([]byte (text ),& response ))
402
- assert .Len (t ,response .Categories ,2 )
403
- assert .Equal (t ,"123" ,response .Categories [0 ]["id" ])
404
- assert .Equal (t ,"CategoryOne" ,response .Categories [0 ]["name" ])
405
- assert .Equal (t ,"456" ,response .Categories [1 ]["id" ])
406
- assert .Equal (t ,"CategoryTwo" ,response .Categories [1 ]["name" ])
407
- assert .Equal (t ,false ,response .PageInfo ["hasNextPage" ])
383
+ var categories []map [string ]string
384
+ require .NoError (t ,json .Unmarshal ([]byte (text ),& categories ))
385
+ assert .Len (t ,categories ,2 )
386
+ assert .Equal (t ,"123" ,categories [0 ]["id" ])
387
+ assert .Equal (t ,"CategoryOne" ,categories [0 ]["name" ])
388
+ assert .Equal (t ,"456" ,categories [1 ]["id" ])
389
+ assert .Equal (t ,"CategoryTwo" ,categories [1 ]["name" ])
408
390
}