MCPcopy
hub / github.com/cli/cli / TestIssueList_withProjectItems

Function TestIssueList_withProjectItems

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

Source from the content-addressed store, hash-verified

587}
588
589func TestIssueList_withProjectItems(t *testing.T) {
590 reg := &httpmock.Registry{}
591 defer reg.Verify(t)
592
593 reg.Register(
594 httpmock.GraphQL(`query IssueList\b`),
595 httpmock.GraphQLQuery(`{
596 "data": {
597 "repository": {
598 "hasIssuesEnabled": true,
599 "issues": {
600 "totalCount": 1,
601 "nodes": [
602 {
603 "projectItems": {
604 "nodes": [
605 {
606 "id": "PVTI_lAHOAA3WC84AW6WNzgJ8rnQ",
607 "project": {
608 "id": "PVT_kwHOAA3WC84AW6WN",
609 "title": "Test Public Project"
610 },
611 "status": {
612 "optionId": "47fc9ee4",
613 "name": "In Progress"
614 }
615 }
616 ],
617 "totalCount": 1
618 }
619 }
620 ]
621 }
622 }
623 }
624 }`, func(_ string, params map[string]interface{}) {
625 require.Equal(t, map[string]interface{}{
626 "owner": "OWNER",
627 "repo": "REPO",
628 "limit": float64(30),
629 "states": []interface{}{"OPEN"},
630 }, params)
631 }))
632
633 client := &http.Client{Transport: reg}
634 issuesAndTotalCount, err := issueList(
635 client,
636 nil,
637 ghrepo.New("OWNER", "REPO"),
638 prShared.FilterOptions{
639 Entity: "issue",
640 },
641 30,
642 )
643
644 require.NoError(t, err)
645 require.Len(t, issuesAndTotalCount.Issues, 1)
646 require.Len(t, issuesAndTotalCount.Issues[0].ProjectItems.Nodes, 1)

Callers

nothing calls this directly

Calls 8

VerifyMethod · 0.95
RegisterMethod · 0.95
GraphQLFunction · 0.92
GraphQLQueryFunction · 0.92
NewFunction · 0.92
issueListFunction · 0.85
EqualMethod · 0.80
LenMethod · 0.65

Tested by

no test coverage detected