Skip to content

Commit c78c30b

Browse files
committed
Add already closed test
1 parent 83ec495 commit c78c30b

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

command/issue_test.go

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -707,6 +707,32 @@ func TestIssueClose(t *testing.T) {
707707
}
708708
}
709709

710+
func TestIssueClose_alreadyClosed(t *testing.T) {
711+
initBlankContext("", "OWNER/REPO", "master")
712+
http := initFakeHTTP()
713+
http.StubRepoResponse("OWNER", "REPO")
714+
715+
http.StubResponse(200, bytes.NewBufferString(`
716+
{ "data": { "repository": {
717+
"hasIssuesEnabled": true,
718+
"issue": { "number": 13, "closed": true}
719+
} } }
720+
`))
721+
722+
http.StubResponse(200, bytes.NewBufferString(`{"id": "THE-ID"}`))
723+
724+
output, err := RunCommand(issueCloseCmd, "issue close 13")
725+
if err != nil {
726+
t.Fatalf("error running command `issue close`: %v", err)
727+
}
728+
729+
r := regexp.MustCompile(`#13 is already closed`)
730+
731+
if !r.MatchString(output.Stderr()) {
732+
t.Fatalf("output did not match regexp /%s/\n> output\n%q\n", r, output.Stderr())
733+
}
734+
}
735+
710736
func TestIssueClose_issuesDisabled(t *testing.T) {
711737
initBlankContext("", "OWNER/REPO", "master")
712738
http := initFakeHTTP()

0 commit comments

Comments
 (0)