@@ -163,21 +163,11 @@ func Test_ListDiscussions(t *testing.T) {
163163 }
164164 require .NoError (t , err )
165165
166- // Debug: print the actual response
167- t .Logf ("Actual response text: %q" , text )
168-
169166 // 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 )
178169 require .NoError (t , err )
179170
180- returnedDiscussions := response .Discussions
181171 assert .Len (t , returnedDiscussions , tc .expectedCount , "Expected %d discussions, got %d" , tc .expectedCount , len (returnedDiscussions ))
182172
183173 // Verify that all returned discussions have a category if filtered
@@ -338,18 +328,14 @@ func Test_GetDiscussionComments(t *testing.T) {
338328
339329 textContent := getTextResult (t , result )
340330
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 )
346333 require .NoError (t , err )
347- assert .Len (t , response . Comments , 2 )
334+ assert .Len (t , comments , 2 )
348335 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 {
350337 assert .Equal (t , expectedBodies [i ], * comment .Body )
351338 }
352- assert .Equal (t , false , response .PageInfo ["hasNextPage" ])
353339}
354340
355341func Test_ListDiscussionCategories (t * testing.T ) {
@@ -394,15 +380,11 @@ func Test_ListDiscussionCategories(t *testing.T) {
394380 require .NoError (t , err )
395381
396382 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" ])
408390}
0 commit comments