add mock for milestones on issue list

This commit is contained in:
Francisco Miamoto 2020-08-01 23:45:21 -03:00
parent 9a5e69a8a4
commit f9b50acc42

View file

@ -170,13 +170,18 @@ func TestIssueList_tty_withFlags(t *testing.T) {
assert.Equal(t, "probablyCher", params["assignee"].(string))
assert.Equal(t, "foo", params["author"].(string))
assert.Equal(t, "me", params["mention"].(string))
assert.Equal(t, "12345", params["milestone"].(string)) // Database ID for the Milestone (see #1441)
assert.Equal(t, []interface{}{"web", "bug"}, params["labels"].([]interface{}))
assert.Equal(t, []interface{}{"OPEN"}, params["states"].([]interface{}))
}))
http.Register(
httpmock.REST("GET", "repos/OWNER/REPO/milestones"),
httpmock.StringResponse("[]"),
)
httpmock.GraphQL(`query RepositoryMilestoneList\b`),
httpmock.StringResponse(`
{ "data": { "repository": { "milestones": {
"nodes": [{ "title":"1.x", "id": "MDk6TWlsZXN0b25lMTIzNDU=" }],
"pageInfo": { "hasNextPage": false }
} } } }
`))
output, err := RunCommand("issue list -a probablyCher -l web,bug -s open -A foo --mention me --milestone 1.x")
if err != nil {