Fix tests broken by incompatible merges

This commit is contained in:
Mislav Marohnić 2021-03-30 18:39:37 +02:00
parent 44ae7ae3cf
commit d22e72a373
2 changed files with 8 additions and 29 deletions

View file

@ -214,27 +214,6 @@ func TestIssueList_web(t *testing.T) {
browser.Verify(t, "https://github.com/OWNER/REPO/issues?q=is%3Aissue+assignee%3Apeter+label%3Abug+label%3Adocs+author%3Ajohn+mentions%3Afrank+milestone%3Av1.1")
}
func TestIssueList_Search_web(t *testing.T) {
http := &httpmock.Registry{}
defer http.Verify(t)
cs, cmdTeardown := run.Stub()
defer cmdTeardown(t)
cs.Register(`https://github\.com`, 0, "", func(args []string) {
url := strings.ReplaceAll(args[len(args)-1], "^", "")
assert.Equal(t, "https://github.com/OWNER/REPO/issues?q=is%3Aissue+assignee%3Apeter+label%3Abug+label%3Adocs+author%3Ajohn+mentions%3Afrank+milestone%3Av1.1+transfer", url)
})
output, err := runCommand(http, true, "--web -a peter -A john -l bug -l docs -L 10 -s all --mention frank --milestone v1.1 --search transfer")
if err != nil {
t.Errorf("error running command `issue list` with `--web` flag: %v", err)
}
assert.Equal(t, "", output.String())
assert.Equal(t, "Opening github.com/OWNER/REPO/issues in your browser.\n", output.Stderr())
}
func Test_issueList(t *testing.T) {
type args struct {
repo ghrepo.Interface

View file

@ -19,7 +19,7 @@ func Test_listPullRequests(t *testing.T) {
tests := []struct {
name string
args args
httpStub func(*httpmock.Registry)
httpStub func(*testing.T, *httpmock.Registry)
wantErr bool
}{
{
@ -31,7 +31,7 @@ func Test_listPullRequests(t *testing.T) {
State: "open",
},
},
httpStub: func(r *httpmock.Registry) {
httpStub: func(t *testing.T, r *httpmock.Registry) {
r.Register(
httpmock.GraphQL(`query PullRequestList\b`),
httpmock.GraphQLQuery(`{"data":{}}`, func(query string, vars map[string]interface{}) {
@ -56,7 +56,7 @@ func Test_listPullRequests(t *testing.T) {
State: "closed",
},
},
httpStub: func(r *httpmock.Registry) {
httpStub: func(t *testing.T, r *httpmock.Registry) {
r.Register(
httpmock.GraphQL(`query PullRequestList\b`),
httpmock.GraphQLQuery(`{"data":{}}`, func(query string, vars map[string]interface{}) {
@ -82,12 +82,12 @@ func Test_listPullRequests(t *testing.T) {
Labels: []string{"hello", "one world"},
},
},
httpStub: func(r *httpmock.Registry) {
httpStub: func(t *testing.T, r *httpmock.Registry) {
r.Register(
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 label:hello label:"one world" sort:created-desc`,
"q": `repo:OWNER/REPO is:pr is:open label:hello label:"one world"`,
"limit": float64(30),
}
if !reflect.DeepEqual(vars, want) {
@ -106,7 +106,7 @@ func Test_listPullRequests(t *testing.T) {
Author: "monalisa",
},
},
httpStub: func(r *httpmock.Registry) {
httpStub: func(t *testing.T, r *httpmock.Registry) {
r.Register(
httpmock.GraphQL(`query PullRequestSearch\b`),
httpmock.GraphQLQuery(`{"data":{}}`, func(query string, vars map[string]interface{}) {
@ -130,7 +130,7 @@ func Test_listPullRequests(t *testing.T) {
Search: "one world in:title",
},
},
httpStub: func(r *httpmock.Registry) {
httpStub: func(t *testing.T, r *httpmock.Registry) {
r.Register(
httpmock.GraphQL(`query PullRequestSearch\b`),
httpmock.GraphQLQuery(`{"data":{}}`, func(query string, vars map[string]interface{}) {
@ -149,7 +149,7 @@ func Test_listPullRequests(t *testing.T) {
t.Run(tt.name, func(t *testing.T) {
reg := &httpmock.Registry{}
if tt.httpStub != nil {
tt.httpStub(reg)
tt.httpStub(t, reg)
}
httpClient := &http.Client{Transport: reg}