@@ -288,6 +288,51 @@ func TestIssueView_preview(t *testing.T) {
288288 }
289289}
290290
291+ func TestIssueView_previewWithEmptyBody (t * testing.T ) {
292+ initBlankContext ("OWNER/REPO" , "master" )
293+ http := initFakeHTTP ()
294+ http .StubRepoResponse ("OWNER" , "REPO" )
295+
296+ http .StubResponse (200 , bytes .NewBufferString (`
297+ { "data": { "repository": { "hasIssuesEnabled": true, "issue": {
298+ "number": 123,
299+ "body": "",
300+ "title": "ix of coins",
301+ "author": {
302+ "login": "marseilles"
303+ },
304+ "labels": {
305+ "nodes": [
306+ {"name": "tarot"}
307+ ]
308+ },
309+ "comments": {
310+ "totalCount": 9
311+ },
312+ "url": "https://github.com/OWNER/REPO/issues/123"
313+ } } } }
314+ ` ))
315+
316+ output , err := RunCommand (issueViewCmd , "issue view -p 123" )
317+ if err != nil {
318+ t .Errorf ("error running command `issue view`: %v" , err )
319+ }
320+
321+ eq (t , output .Stderr (), "" )
322+
323+ expectedLines := []* regexp.Regexp {
324+ regexp .MustCompile (`ix of coins` ),
325+ regexp .MustCompile (`opened by marseilles. 9 comments. \(tarot\)` ),
326+ regexp .MustCompile (`View this issue on GitHub: https://github.com/OWNER/REPO/issues/123` ),
327+ }
328+ for _ , r := range expectedLines {
329+ if ! r .MatchString (output .String ()) {
330+ t .Errorf ("output did not match regexp /%s/\n > output\n %s\n " , r , output )
331+ return
332+ }
333+ }
334+ }
335+
291336func TestIssueView_notFound (t * testing.T ) {
292337 initBlankContext ("OWNER/REPO" , "master" )
293338 http := initFakeHTTP ()
0 commit comments