(t *testing.T)
| 143 | } |
| 144 | |
| 145 | func TestIssueView_nontty_Preview(t *testing.T) { |
| 146 | tests := map[string]struct { |
| 147 | httpStubs func(*httpmock.Registry) |
| 148 | expectedOutputs []string |
| 149 | }{ |
| 150 | "Open issue without metadata": { |
| 151 | httpStubs: func(r *httpmock.Registry) { |
| 152 | r.Register(httpmock.GraphQL(`query IssueByNumber\b`), httpmock.FileResponse("./fixtures/issueView_preview.json")) |
| 153 | mockEmptyV2ProjectItems(t, r) |
| 154 | }, |
| 155 | expectedOutputs: []string{ |
| 156 | `title:\tix of coins`, |
| 157 | `state:\tOPEN`, |
| 158 | `comments:\t9`, |
| 159 | `author:\tmarseilles`, |
| 160 | `assignees:`, |
| 161 | `number:\t123\n`, |
| 162 | `\*\*bold story\*\*`, |
| 163 | }, |
| 164 | }, |
| 165 | "Open issue with metadata": { |
| 166 | httpStubs: func(r *httpmock.Registry) { |
| 167 | r.Register(httpmock.GraphQL(`query IssueByNumber\b`), httpmock.FileResponse("./fixtures/issueView_previewWithMetadata.json")) |
| 168 | mockV2ProjectItems(t, r) |
| 169 | }, |
| 170 | expectedOutputs: []string{ |
| 171 | `title:\tix of coins`, |
| 172 | `assignees:\tmarseilles, monaco`, |
| 173 | `author:\tmarseilles`, |
| 174 | `state:\tOPEN`, |
| 175 | `comments:\t9`, |
| 176 | `labels:\tClosed: Duplicate, Closed: Won't Fix, help wanted, Status: In Progress, Type: Bug`, |
| 177 | `projects:\tv2 Project 1 \(No Status\), v2 Project 2 \(Done\), Project 1 \(column A\), Project 2 \(column B\), Project 3 \(column C\), Project 4 \(Awaiting triage\)\n`, |
| 178 | `milestone:\tuluru\n`, |
| 179 | `number:\t123\n`, |
| 180 | `\*\*bold story\*\*`, |
| 181 | }, |
| 182 | }, |
| 183 | "Open issue with empty body": { |
| 184 | httpStubs: func(r *httpmock.Registry) { |
| 185 | r.Register(httpmock.GraphQL(`query IssueByNumber\b`), httpmock.FileResponse("./fixtures/issueView_previewWithEmptyBody.json")) |
| 186 | mockEmptyV2ProjectItems(t, r) |
| 187 | }, |
| 188 | expectedOutputs: []string{ |
| 189 | `title:\tix of coins`, |
| 190 | `state:\tOPEN`, |
| 191 | `author:\tmarseilles`, |
| 192 | `labels:\ttarot`, |
| 193 | `number:\t123\n`, |
| 194 | }, |
| 195 | }, |
| 196 | "Closed issue": { |
| 197 | httpStubs: func(r *httpmock.Registry) { |
| 198 | r.Register(httpmock.GraphQL(`query IssueByNumber\b`), httpmock.FileResponse("./fixtures/issueView_previewClosedState.json")) |
| 199 | mockEmptyV2ProjectItems(t, r) |
| 200 | }, |
| 201 | expectedOutputs: []string{ |
| 202 | `title:\tix of coins`, |
nothing calls this directly
no test coverage detected