Skip to content

Commit 83d80e6

Browse files
committed
add test for milestone not found
1 parent bbce1ba commit 83d80e6

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

command/issue_test.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,29 @@ func TestIssueList_web(t *testing.T) {
282282
eq(t, url, expectedURL)
283283
}
284284

285+
func TestIssueList_milestoneNotFound(t *testing.T) {
286+
initBlankContext("", "OWNER/REPO", "master")
287+
http := initFakeHTTP()
288+
http.StubRepoResponse("OWNER", "REPO")
289+
http.Register(
290+
httpmock.GraphQL(`query IssueList\b`),
291+
httpmock.FileResponse("../test/fixtures/issueList.json"),
292+
)
293+
http.Register(
294+
httpmock.GraphQL(`query RepositoryMilestoneList\b`),
295+
httpmock.StringResponse(`
296+
{ "data": { "repository": { "milestones": {
297+
"nodes": [{ "title":"1.x", "id": "MDk6TWlsZXN0b25lMTIzNDU=" }],
298+
"pageInfo": { "hasNextPage": false }
299+
} } } }
300+
`))
301+
302+
_, err := RunCommand("issue list --milestone NotFound")
303+
if err == nil || err.Error() != `no milestone found with title: "NotFound"` {
304+
t.Errorf("error running command `issue list`: %v", err)
305+
}
306+
}
307+
285308
func TestIssueView_web(t *testing.T) {
286309
initBlankContext("", "OWNER/REPO", "master")
287310
http := initFakeHTTP()

0 commit comments

Comments
 (0)