@@ -309,6 +309,36 @@ func TestIssueView_preview(t *testing.T) {
309309 }
310310}
311311
312+ func TestIssueView_previewClosedState (t * testing.T ) {
313+ initBlankContext ("OWNER/REPO" , "master" )
314+ http := initFakeHTTP ()
315+ http .StubRepoResponse ("OWNER" , "REPO" )
316+
317+ jsonFile , _ := os .Open ("../test/fixtures/issueView_previewClosedState.json" )
318+ defer jsonFile .Close ()
319+ http .StubResponse (200 , jsonFile )
320+
321+ output , err := RunCommand (issueViewCmd , "issue view -p 123" )
322+ if err != nil {
323+ t .Errorf ("error running command `issue view`: %v" , err )
324+ }
325+
326+ eq (t , output .Stderr (), "" )
327+
328+ expectedLines := []* regexp.Regexp {
329+ regexp .MustCompile (`ix of coins` ),
330+ regexp .MustCompile (`CLOSED • marseilles opened about 292 years ago • 9 comments • tarot` ),
331+ regexp .MustCompile (`bold story` ),
332+ regexp .MustCompile (`View this issue on GitHub: https://github.com/OWNER/REPO/issues/123` ),
333+ }
334+ for _ , r := range expectedLines {
335+ if ! r .MatchString (output .String ()) {
336+ t .Errorf ("output did not match regexp /%s/\n > output\n %s\n " , r , output )
337+ return
338+ }
339+ }
340+ }
341+
312342func TestIssueView_previewWithEmptyBody (t * testing.T ) {
313343 initBlankContext ("OWNER/REPO" , "master" )
314344 http := initFakeHTTP ()
0 commit comments