(t *testing.T)
| 307 | } |
| 308 | |
| 309 | func Test_issueList(t *testing.T) { |
| 310 | type args struct { |
| 311 | detector fd.Detector |
| 312 | repo ghrepo.Interface |
| 313 | filters prShared.FilterOptions |
| 314 | limit int |
| 315 | } |
| 316 | tests := []struct { |
| 317 | name string |
| 318 | args args |
| 319 | httpStubs func(*httpmock.Registry) |
| 320 | wantErr bool |
| 321 | }{ |
| 322 | { |
| 323 | name: "default", |
| 324 | args: args{ |
| 325 | limit: 30, |
| 326 | repo: ghrepo.New("OWNER", "REPO"), |
| 327 | filters: prShared.FilterOptions{ |
| 328 | Entity: "issue", |
| 329 | State: "open", |
| 330 | }, |
| 331 | }, |
| 332 | httpStubs: func(reg *httpmock.Registry) { |
| 333 | reg.Register( |
| 334 | httpmock.GraphQL(`query IssueList\b`), |
| 335 | httpmock.GraphQLQuery(` |
| 336 | { "data": { "repository": { |
| 337 | "hasIssuesEnabled": true, |
| 338 | "issues": { "nodes": [] } |
| 339 | } } }`, func(_ string, params map[string]interface{}) { |
| 340 | assert.Equal(t, map[string]interface{}{ |
| 341 | "owner": "OWNER", |
| 342 | "repo": "REPO", |
| 343 | "limit": float64(30), |
| 344 | "states": []interface{}{"OPEN"}, |
| 345 | }, params) |
| 346 | })) |
| 347 | }, |
| 348 | }, |
| 349 | { |
| 350 | name: "milestone by number", |
| 351 | args: args{ |
| 352 | // TODO advancedIssueSearchCleanup |
| 353 | // No need for feature detection once GHES 3.17 support ends. |
| 354 | detector: fd.AdvancedIssueSearchSupportedAsOptIn(), |
| 355 | limit: 30, |
| 356 | repo: ghrepo.New("OWNER", "REPO"), |
| 357 | filters: prShared.FilterOptions{ |
| 358 | Entity: "issue", |
| 359 | State: "open", |
| 360 | Milestone: "13", |
| 361 | }, |
| 362 | }, |
| 363 | httpStubs: func(reg *httpmock.Registry) { |
| 364 | reg.Register( |
| 365 | httpmock.GraphQL(`query RepositoryMilestoneByNumber\b`), |
| 366 | httpmock.StringResponse(` |
nothing calls this directly
no test coverage detected