MCPcopy Create free account
hub / github.com/cli/cli / mockV2ProjectItems

Function mockV2ProjectItems

pkg/cmd/issue/view/view_test.go:626–657  ·  view source on GitHub ↗

mockV2ProjectItems registers GraphQL queries to report an issue on multiple v2 projects in various states - `NO_STATUS_ITEM`: emulates this issue is on a project but is not given a status - `DONE_STATUS_ITEM`: emulates this issue is on a project and considered done

(t *testing.T, r *httpmock.Registry)

Source from the content-addressed store, hash-verified

624// - `NO_STATUS_ITEM`: emulates this issue is on a project but is not given a status
625// - `DONE_STATUS_ITEM`: emulates this issue is on a project and considered done
626func mockV2ProjectItems(t *testing.T, r *httpmock.Registry) {
627 r.Register(httpmock.GraphQL(`query IssueProjectItems\b`), httpmock.StringResponse(`
628 { "data": { "repository": { "issue": {
629 "projectItems": {
630 "totalCount": 2,
631 "nodes": [
632 {
633 "id": "NO_STATUS_ITEM",
634 "project": {
635 "id": "PROJECT1",
636 "title": "v2 Project 1"
637 },
638 "status": {
639 "optionId": "",
640 "name": ""
641 }
642 },
643 {
644 "id": "DONE_STATUS_ITEM",
645 "project": {
646 "id": "PROJECT2",
647 "title": "v2 Project 2"
648 },
649 "status": {
650 "optionId": "PROJECTITEMFIELD1",
651 "name": "Done"
652 }
653 }
654 ]
655 } } } } }
656 `))
657}
658
659// issueResponseAllIssues2Fields returns a GraphQL response for an issue with all Issues 2.0 fields populated.
660func issueResponseAllIssues2Fields() string {

Callers 2

Calls 3

GraphQLFunction · 0.92
StringResponseFunction · 0.92
RegisterMethod · 0.45

Tested by

no test coverage detected