MCPcopy
hub / github.com/cli/cli / Test_issueList

Function Test_issueList

pkg/cmd/issue/list/list_test.go:309–587  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

307}
308
309func 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(`

Callers

nothing calls this directly

Calls 10

VerifyMethod · 0.95
NewFunction · 0.92
GraphQLFunction · 0.92
GraphQLQueryFunction · 0.92
StringResponseFunction · 0.92
issueListFunction · 0.85
EqualMethod · 0.80
RunMethod · 0.65
RegisterMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected