From e5fc3e9bbd281aeaaf4d07829f0fa81dfc0ac3c9 Mon Sep 17 00:00:00 2001 From: Corey Johnson Date: Tue, 28 Apr 2020 09:11:19 -0700 Subject: [PATCH] Update issue_test.go Add test for closing issue Co-Authored-By: Nate Smith --- command/issue_test.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/command/issue_test.go b/command/issue_test.go index b7f91031d..2185fc390 100644 --- a/command/issue_test.go +++ b/command/issue_test.go @@ -680,3 +680,25 @@ func TestIssueStateTitleWithColor(t *testing.T) { }) } } + +func TestIssueClose(t *testing.T) { + initBlankContext("", "OWNER/REPO", "master") + http := initFakeHTTP() + http.StubRepoResponse("OWNER", "REPO") + + jsonFile, _ := os.Open("../test/fixtures/issueClose.json") + defer jsonFile.Close() + http.StubResponse(200, jsonFile) + + output, err := RunCommand(issueStatusCmd, "issue close 13") + if err != nil { + t.Errorf("error running command `issue close`: %v", err) + } + + r := regexp.MustCompile(`WHATEVER!`) + + if !r.MatchString(output.String()) { + t.Errorf("output did not match regexp /%s/\n> output\n%s\n", r, output) + return + } +}