(t *testing.T)
| 231 | } |
| 232 | |
| 233 | func TestIssueView_tty_Preview(t *testing.T) { |
| 234 | tests := map[string]struct { |
| 235 | httpStubs func(*httpmock.Registry) |
| 236 | expectedOutputs []string |
| 237 | }{ |
| 238 | "Open issue without metadata": { |
| 239 | httpStubs: func(r *httpmock.Registry) { |
| 240 | r.Register(httpmock.GraphQL(`query IssueByNumber\b`), httpmock.FileResponse("./fixtures/issueView_preview.json")) |
| 241 | mockEmptyV2ProjectItems(t, r) |
| 242 | }, |
| 243 | expectedOutputs: []string{ |
| 244 | `ix of coins OWNER/REPO#123`, |
| 245 | `Open.*marseilles opened about 9 years ago.*9 comments`, |
| 246 | `bold story`, |
| 247 | `View this issue on GitHub: https://github.com/OWNER/REPO/issues/123`, |
| 248 | }, |
| 249 | }, |
| 250 | "Open issue with metadata": { |
| 251 | httpStubs: func(r *httpmock.Registry) { |
| 252 | r.Register(httpmock.GraphQL(`query IssueByNumber\b`), httpmock.FileResponse("./fixtures/issueView_previewWithMetadata.json")) |
| 253 | mockV2ProjectItems(t, r) |
| 254 | }, |
| 255 | expectedOutputs: []string{ |
| 256 | `ix of coins OWNER/REPO#123`, |
| 257 | `Open.*marseilles opened about 9 years ago.*9 comments`, |
| 258 | `8 \x{1f615} • 7 \x{1f440} • 6 \x{2764}\x{fe0f} • 5 \x{1f389} • 4 \x{1f604} • 3 \x{1f680} • 2 \x{1f44e} • 1 \x{1f44d}`, |
| 259 | `Assignees:.*marseilles, monaco\n`, |
| 260 | `Labels:.*Closed: Duplicate, Closed: Won't Fix, help wanted, Status: In Progress, Type: Bug\n`, |
| 261 | `Projects:.*v2 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`, |
| 262 | `Milestone:.*uluru\n`, |
| 263 | `bold story`, |
| 264 | `View this issue on GitHub: https://github.com/OWNER/REPO/issues/123`, |
| 265 | }, |
| 266 | }, |
| 267 | "Open issue with empty body": { |
| 268 | httpStubs: func(r *httpmock.Registry) { |
| 269 | r.Register(httpmock.GraphQL(`query IssueByNumber\b`), httpmock.FileResponse("./fixtures/issueView_previewWithEmptyBody.json")) |
| 270 | mockEmptyV2ProjectItems(t, r) |
| 271 | }, |
| 272 | expectedOutputs: []string{ |
| 273 | `ix of coins OWNER/REPO#123`, |
| 274 | `Open.*marseilles opened about 9 years ago.*9 comments`, |
| 275 | `No description provided`, |
| 276 | `View this issue on GitHub: https://github.com/OWNER/REPO/issues/123`, |
| 277 | }, |
| 278 | }, |
| 279 | "Closed issue": { |
| 280 | httpStubs: func(r *httpmock.Registry) { |
| 281 | r.Register(httpmock.GraphQL(`query IssueByNumber\b`), httpmock.FileResponse("./fixtures/issueView_previewClosedState.json")) |
| 282 | mockEmptyV2ProjectItems(t, r) |
| 283 | }, |
| 284 | expectedOutputs: []string{ |
| 285 | `ix of coins OWNER/REPO#123`, |
| 286 | `Closed.*marseilles opened about 9 years ago.*9 comments`, |
| 287 | `bold story`, |
| 288 | `View this issue on GitHub: https://github.com/OWNER/REPO/issues/123`, |
| 289 | }, |
| 290 | }, |
nothing calls this directly
no test coverage detected