MCPcopy Index your code
hub / github.com/cli/cli / mockV2ProjectItems

Function mockV2ProjectItems

pkg/cmd/issue/view/view_test.go:614–645  ·  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

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

Callers 2

Calls 3

GraphQLFunction · 0.92
StringResponseFunction · 0.92
RegisterMethod · 0.45

Tested by

no test coverage detected