Remove implicit sort:created-desc sort clause for pr list

This is the default sort mode for issues, so it's not needed to
explicitly set it. Furthermore, the user can specify their own sort mode
through the `--search` option.
This commit is contained in:
Mislav Marohnić 2021-03-25 13:44:07 +01:00
parent 2fa8a85813
commit 210d9dff20
3 changed files with 3 additions and 4 deletions

View file

@ -172,7 +172,6 @@ func searchPullRequests(httpClient *http.Client, repo ghrepo.Interface, filters
q.SetType(githubsearch.PullRequest)
q.InRepository(ghrepo.FullName(repo))
q.AddQuery(filters.Search)
q.SortBy(githubsearch.CreatedAt, githubsearch.Desc)
switch filters.State {
case "open":

View file

@ -116,7 +116,7 @@ func Test_listPullRequests(t *testing.T) {
httpmock.GraphQL(`query PullRequestSearch\b`),
httpmock.GraphQLQuery(`{"data":{}}`, func(query string, vars map[string]interface{}) {
want := map[string]interface{}{
"q": "repo:OWNER/REPO is:pr is:open author:monalisa sort:created-desc",
"q": "repo:OWNER/REPO is:pr is:open author:monalisa",
"limit": float64(30),
}
if !reflect.DeepEqual(vars, want) {
@ -140,7 +140,7 @@ func Test_listPullRequests(t *testing.T) {
httpmock.GraphQL(`query PullRequestSearch\b`),
httpmock.GraphQLQuery(`{"data":{}}`, func(query string, vars map[string]interface{}) {
want := map[string]interface{}{
"q": "repo:OWNER/REPO is:pr is:open sort:created-desc one world in:title",
"q": "repo:OWNER/REPO is:pr is:open one world in:title",
"limit": float64(30),
}
if !reflect.DeepEqual(vars, want) {

View file

@ -165,7 +165,7 @@ func TestPRList_filteringAssignee(t *testing.T) {
http.Register(
httpmock.GraphQL(`query PullRequestSearch\b`),
httpmock.GraphQLQuery(`{}`, func(_ string, params map[string]interface{}) {
assert.Equal(t, `repo:OWNER/REPO is:pr is:merged assignee:hubot label:"needs tests" base:develop sort:created-desc`, params["q"].(string))
assert.Equal(t, `repo:OWNER/REPO is:pr is:merged assignee:hubot label:"needs tests" base:develop`, params["q"].(string))
}))
_, err := runCommand(http, true, `-s merged -l "needs tests" -a hubot -B develop`)