(t *testing.T)
| 86 | } |
| 87 | |
| 88 | func TestIssueList_pagination(t *testing.T) { |
| 89 | reg := &httpmock.Registry{} |
| 90 | httpClient := &http.Client{} |
| 91 | httpmock.ReplaceTripper(httpClient, reg) |
| 92 | client := api.NewClientFromHTTP(httpClient) |
| 93 | |
| 94 | reg.Register( |
| 95 | httpmock.GraphQL(`query IssueList\b`), |
| 96 | httpmock.StringResponse(` |
| 97 | { "data": { "repository": { |
| 98 | "hasIssuesEnabled": true, |
| 99 | "issues": { |
| 100 | "nodes": [ |
| 101 | { |
| 102 | "title": "issue1", |
| 103 | "labels": { "nodes": [ { "name": "bug" } ], "totalCount": 1 }, |
| 104 | "assignees": { "nodes": [ { "login": "user1" } ], "totalCount": 1 } |
| 105 | } |
| 106 | ], |
| 107 | "pageInfo": { |
| 108 | "hasNextPage": true, |
| 109 | "endCursor": "ENDCURSOR" |
| 110 | }, |
| 111 | "totalCount": 2 |
| 112 | } |
| 113 | } } } |
| 114 | `), |
| 115 | ) |
| 116 | |
| 117 | reg.Register( |
| 118 | httpmock.GraphQL(`query IssueList\b`), |
| 119 | httpmock.StringResponse(` |
| 120 | { "data": { "repository": { |
| 121 | "hasIssuesEnabled": true, |
| 122 | "issues": { |
| 123 | "nodes": [ |
| 124 | { |
| 125 | "title": "issue2", |
| 126 | "labels": { "nodes": [ { "name": "enhancement" } ], "totalCount": 1 }, |
| 127 | "assignees": { "nodes": [ { "login": "user2" } ], "totalCount": 1 } |
| 128 | } |
| 129 | ], |
| 130 | "pageInfo": { |
| 131 | "hasNextPage": false, |
| 132 | "endCursor": "ENDCURSOR" |
| 133 | }, |
| 134 | "totalCount": 2 |
| 135 | } |
| 136 | } } } |
| 137 | `), |
| 138 | ) |
| 139 | |
| 140 | repo := ghrepo.New("OWNER", "REPO") |
| 141 | res, err := listIssues(client, repo, prShared.FilterOptions{}, 0) |
| 142 | if err != nil { |
| 143 | t.Fatalf("IssueList() error = %v", err) |
| 144 | } |
| 145 |
nothing calls this directly
no test coverage detected