add test for milestone not found

This commit is contained in:
Francisco Miamoto 2020-08-05 21:12:03 -03:00
parent bbce1ba755
commit 83d80e6a09

View file

@ -282,6 +282,29 @@ func TestIssueList_web(t *testing.T) {
eq(t, url, expectedURL)
}
func TestIssueList_milestoneNotFound(t *testing.T) {
initBlankContext("", "OWNER/REPO", "master")
http := initFakeHTTP()
http.StubRepoResponse("OWNER", "REPO")
http.Register(
httpmock.GraphQL(`query IssueList\b`),
httpmock.FileResponse("../test/fixtures/issueList.json"),
)
http.Register(
httpmock.GraphQL(`query RepositoryMilestoneList\b`),
httpmock.StringResponse(`
{ "data": { "repository": { "milestones": {
"nodes": [{ "title":"1.x", "id": "MDk6TWlsZXN0b25lMTIzNDU=" }],
"pageInfo": { "hasNextPage": false }
} } } }
`))
_, err := RunCommand("issue list --milestone NotFound")
if err == nil || err.Error() != `no milestone found with title: "NotFound"` {
t.Errorf("error running command `issue list`: %v", err)
}
}
func TestIssueView_web(t *testing.T) {
initBlankContext("", "OWNER/REPO", "master")
http := initFakeHTTP()