(t *testing.T)
| 100 | } |
| 101 | |
| 102 | func TestIssueDelete_confirm(t *testing.T) { |
| 103 | httpRegistry := &httpmock.Registry{} |
| 104 | defer httpRegistry.Verify(t) |
| 105 | |
| 106 | httpRegistry.Register( |
| 107 | httpmock.GraphQL(`query IssueByNumber\b`), |
| 108 | httpmock.StringResponse(` |
| 109 | { "data": { "repository": { |
| 110 | "hasIssuesEnabled": true, |
| 111 | "issue": { "id": "THE-ID", "number": 13, "title": "The title of the issue"} |
| 112 | } } }`), |
| 113 | ) |
| 114 | httpRegistry.Register( |
| 115 | httpmock.GraphQL(`mutation IssueDelete\b`), |
| 116 | httpmock.GraphQLMutation(`{"id": "THE-ID"}`, |
| 117 | func(inputs map[string]interface{}) { |
| 118 | assert.Equal(t, inputs["issueId"], "THE-ID") |
| 119 | }), |
| 120 | ) |
| 121 | |
| 122 | output, err := runCommand(httpRegistry, nil, true, "13 --confirm") |
| 123 | if err != nil { |
| 124 | t.Fatalf("error running command `issue delete`: %v", err) |
| 125 | } |
| 126 | |
| 127 | r := regexp.MustCompile(`Deleted issue OWNER/REPO#13 \(The title of the issue\)`) |
| 128 | |
| 129 | if !r.MatchString(output.Stderr()) { |
| 130 | t.Fatalf("output did not match regexp /%s/\n> output\n%q\n", r, output.Stderr()) |
| 131 | } |
| 132 | } |
| 133 | |
| 134 | func TestIssueDelete_cancel(t *testing.T) { |
| 135 | httpRegistry := &httpmock.Registry{} |
nothing calls this directly
no test coverage detected