(t *testing.T)
| 169 | } |
| 170 | |
| 171 | func TestProjectItems_NoLimit(t *testing.T) { |
| 172 | defer gock.Off() |
| 173 | gock.Observe(gock.DumpRequest) |
| 174 | |
| 175 | // list project items |
| 176 | gock.New("https://api.github.com"). |
| 177 | Post("/graphql"). |
| 178 | JSON(map[string]interface{}{ |
| 179 | "query": "query UserProjectWithItems.*", |
| 180 | "variables": map[string]interface{}{ |
| 181 | "firstItems": LimitDefault, |
| 182 | "afterItems": nil, |
| 183 | "firstFields": LimitMax, |
| 184 | "afterFields": nil, |
| 185 | "login": "monalisa", |
| 186 | "number": 1, |
| 187 | }, |
| 188 | }). |
| 189 | Reply(200). |
| 190 | JSON(map[string]interface{}{ |
| 191 | "data": map[string]interface{}{ |
| 192 | "user": map[string]interface{}{ |
| 193 | "projectV2": map[string]interface{}{ |
| 194 | "items": map[string]interface{}{ |
| 195 | "nodes": []map[string]interface{}{ |
| 196 | { |
| 197 | "id": "issue ID", |
| 198 | }, |
| 199 | { |
| 200 | "id": "pull request ID", |
| 201 | }, |
| 202 | { |
| 203 | "id": "draft issue ID", |
| 204 | }, |
| 205 | }, |
| 206 | }, |
| 207 | }, |
| 208 | }, |
| 209 | }, |
| 210 | }) |
| 211 | |
| 212 | client := NewTestClient() |
| 213 | |
| 214 | owner := &Owner{ |
| 215 | Type: "USER", |
| 216 | Login: "monalisa", |
| 217 | ID: "user ID", |
| 218 | } |
| 219 | project, err := client.ProjectItems(owner, 1, 0, "") |
| 220 | assert.NoError(t, err) |
| 221 | assert.Len(t, project.Items.Nodes, 3) |
| 222 | } |
| 223 | |
| 224 | func TestProjectItems_WithQuery(t *testing.T) { |
| 225 | tests := []struct { |
nothing calls this directly
no test coverage detected