30
30
"discussions" : map [string ]any {
31
31
"nodes" : discussionsAll ,
32
32
"pageInfo" : map [string ]any {
33
- "hasNextPage" : false ,
34
- "endCursor" : "" ,
33
+ "hasNextPage" : false ,
34
+ "hasPreviousPage" : false ,
35
+ "startCursor" : "" ,
36
+ "endCursor" : "" ,
35
37
},
38
+ "totalCount" : 3 ,
36
39
},
37
40
},
38
41
})
41
44
"discussions" : map [string ]any {
42
45
"nodes" : discussionsGeneral ,
43
46
"pageInfo" : map [string ]any {
44
- "hasNextPage" : false ,
45
- "endCursor" : "" ,
47
+ "hasNextPage" : false ,
48
+ "hasPreviousPage" : false ,
49
+ "startCursor" : "" ,
50
+ "endCursor" : "" ,
46
51
},
52
+ "totalCount" : 2 ,
47
53
},
48
54
},
49
55
})
@@ -61,9 +67,9 @@ func Test_ListDiscussions(t *testing.T) {
61
67
assert .ElementsMatch (t , toolDef .InputSchema .Required , []string {"owner" , "repo" })
62
68
63
69
// Use exact string queries that match implementation output (from error messages)
64
- qDiscussions := "query($after:String$first:Int!$owner:String!$repo:String!){repository(owner: $owner, name: $repo){discussions(first: $first, after: $after){nodes{number,title,createdAt,category{name},url},pageInfo{hasNextPage,endCursor}}}}"
70
+ qDiscussions := "query($after:String$first:Int!$owner:String!$repo:String!){repository(owner: $owner, name: $repo){discussions(first: $first, after: $after){nodes{number,title,createdAt,category{name},url},pageInfo{hasNextPage,hasPreviousPage,startCursor, endCursor},totalCount }}}"
65
71
66
- qDiscussionsFiltered := "query($after:String$categoryId:ID!$first:Int!$owner:String!$repo:String!){repository(owner: $owner, name: $repo){discussions(first: $first, after: $after, categoryId: $categoryId){nodes{number,title,createdAt,category{name},url},pageInfo{hasNextPage,endCursor}}}}"
72
+ qDiscussionsFiltered := "query($after:String$categoryId:ID!$first:Int!$owner:String!$repo:String!){repository(owner: $owner, name: $repo){discussions(first: $first, after: $after, categoryId: $categoryId){nodes{number,title,createdAt,category{name},url},pageInfo{hasNextPage,hasPreviousPage,startCursor, endCursor},totalCount }}}"
67
73
68
74
// Variables matching what GraphQL receives after JSON marshaling/unmarshaling
69
75
varsListAll := map [string ]interface {}{
@@ -161,9 +167,12 @@ func Test_ListDiscussions(t *testing.T) {
161
167
var response struct {
162
168
Discussions []* github.Discussion `json:"discussions"`
163
169
PageInfo struct {
164
- HasNextPage bool `json:"hasNextPage"`
165
- EndCursor string `json:"endCursor"`
170
+ HasNextPage bool `json:"hasNextPage"`
171
+ HasPreviousPage bool `json:"hasPreviousPage"`
172
+ StartCursor string `json:"startCursor"`
173
+ EndCursor string `json:"endCursor"`
166
174
} `json:"pageInfo"`
175
+ TotalCount int `json:"totalCount"`
167
176
}
168
177
err = json .Unmarshal ([]byte (text ), & response )
169
178
require .NoError (t , err )
@@ -275,7 +284,7 @@ func Test_GetDiscussionComments(t *testing.T) {
275
284
assert .ElementsMatch (t , toolDef .InputSchema .Required , []string {"owner" , "repo" , "discussionNumber" })
276
285
277
286
// Use exact string query that matches implementation output
278
- qGetComments := "query($after:String$discussionNumber:Int!$first:Int!$owner:String!$repo:String!){repository(owner: $owner, name: $repo){discussion(number: $discussionNumber){comments(first: $first, after: $after){nodes{body},pageInfo{hasNextPage,endCursor}}}}}"
287
+ qGetComments := "query($after:String$discussionNumber:Int!$first:Int!$owner:String!$repo:String!){repository(owner: $owner, name: $repo){discussion(number: $discussionNumber){comments(first: $first, after: $after){nodes{body},pageInfo{hasNextPage,hasPreviousPage,startCursor, endCursor},totalCount }}}}"
279
288
280
289
// Variables matching what GraphQL receives after JSON marshaling/unmarshaling
281
290
vars := map [string ]interface {}{
@@ -295,9 +304,12 @@ func Test_GetDiscussionComments(t *testing.T) {
295
304
{"body" : "This is the second comment" },
296
305
},
297
306
"pageInfo" : map [string ]any {
298
- "hasNextPage" : false ,
299
- "endCursor" : "" ,
307
+ "hasNextPage" : false ,
308
+ "hasPreviousPage" : false ,
309
+ "startCursor" : "" ,
310
+ "endCursor" : "" ,
300
311
},
312
+ "totalCount" : 2 ,
301
313
},
302
314
},
303
315
},
@@ -323,9 +335,12 @@ func Test_GetDiscussionComments(t *testing.T) {
323
335
var response struct {
324
336
Comments []* github.IssueComment `json:"comments"`
325
337
PageInfo struct {
326
- HasNextPage bool `json:"hasNextPage"`
327
- EndCursor string `json:"endCursor"`
338
+ HasNextPage bool `json:"hasNextPage"`
339
+ HasPreviousPage bool `json:"hasPreviousPage"`
340
+ StartCursor string `json:"startCursor"`
341
+ EndCursor string `json:"endCursor"`
328
342
} `json:"pageInfo"`
343
+ TotalCount int `json:"totalCount"`
329
344
}
330
345
err = json .Unmarshal ([]byte (textContent .Text ), & response )
331
346
require .NoError (t , err )
@@ -338,7 +353,7 @@ func Test_GetDiscussionComments(t *testing.T) {
338
353
339
354
func Test_ListDiscussionCategories (t * testing.T ) {
340
355
// Use exact string query that matches implementation output
341
- qListCategories := "query($after:String$first:Int!$owner:String!$repo:String!){repository(owner: $owner, name: $repo){discussionCategories(first: $first, after: $after){nodes{id,name},pageInfo{hasNextPage,endCursor}}}}"
356
+ qListCategories := "query($after:String$first:Int!$owner:String!$repo:String!){repository(owner: $owner, name: $repo){discussionCategories(first: $first, after: $after){nodes{id,name},pageInfo{hasNextPage,hasPreviousPage,startCursor, endCursor},totalCount }}}"
342
357
343
358
// Variables matching what GraphQL receives after JSON marshaling/unmarshaling
344
359
vars := map [string ]interface {}{
@@ -356,9 +371,12 @@ func Test_ListDiscussionCategories(t *testing.T) {
356
371
{"id" : "456" , "name" : "CategoryTwo" },
357
372
},
358
373
"pageInfo" : map [string ]any {
359
- "hasNextPage" : false ,
360
- "endCursor" : "" ,
374
+ "hasNextPage" : false ,
375
+ "hasPreviousPage" : false ,
376
+ "startCursor" : "" ,
377
+ "endCursor" : "" ,
361
378
},
379
+ "totalCount" : 2 ,
362
380
},
363
381
},
364
382
})
@@ -385,9 +403,12 @@ func Test_ListDiscussionCategories(t *testing.T) {
385
403
var response struct {
386
404
Categories []map [string ]string `json:"categories"`
387
405
PageInfo struct {
388
- HasNextPage bool `json:"hasNextPage"`
389
- EndCursor string `json:"endCursor"`
406
+ HasNextPage bool `json:"hasNextPage"`
407
+ HasPreviousPage bool `json:"hasPreviousPage"`
408
+ StartCursor string `json:"startCursor"`
409
+ EndCursor string `json:"endCursor"`
390
410
} `json:"pageInfo"`
411
+ TotalCount int `json:"totalCount"`
391
412
}
392
413
require .NoError (t , json .Unmarshal ([]byte (text ), & response ))
393
414
assert .Len (t , response .Categories , 2 )
0 commit comments