diff --git a/api/queries_branch_issue_reference.go b/api/queries_branch_issue_reference.go index a3681421d..d4ca43233 100644 --- a/api/queries_branch_issue_reference.go +++ b/api/queries_branch_issue_reference.go @@ -1,7 +1,5 @@ package api -import "fmt" - type BranchIssueReference struct { ID int BranchName string @@ -40,7 +38,7 @@ func CreateBranchIssueReference(client *Client, repo *Repository, params map[str } result := struct { - createLinkedBranch struct { + CreateLinkedBranch struct { LinkedBranch struct { ID int Ref struct { @@ -54,10 +52,10 @@ func CreateBranchIssueReference(client *Client, repo *Repository, params map[str if err != nil { return nil, err } - fmt.Printf("result %#v", &result) + ref := BranchIssueReference{ - ID: result.createLinkedBranch.LinkedBranch.ID, - BranchName: result.createLinkedBranch.LinkedBranch.Ref.Name, + ID: result.CreateLinkedBranch.LinkedBranch.ID, + BranchName: result.CreateLinkedBranch.LinkedBranch.Ref.Name, } return &ref, nil diff --git a/pkg/cmd/issue/develop/develop_test.go b/pkg/cmd/issue/develop/develop_test.go index 9ab2a15c5..5a86a0a7f 100644 --- a/pkg/cmd/issue/develop/develop_test.go +++ b/pkg/cmd/issue/develop/develop_test.go @@ -35,7 +35,6 @@ func Test_developRun(t *testing.T) { return func() {} }, httpStubs: func(reg *httpmock.Registry, t *testing.T) { - reg.StubRepoResponse("OWNER", "REPO") reg.Register( httpmock.GraphQL(`query RepositoryInfo\b`), @@ -56,7 +55,9 @@ func Test_developRun(t *testing.T) { httpmock.GraphQL(`mutation CreateLinkedBranch\b`), httpmock.GraphQLMutation(`{ "data": { "createLinkedBranch": { "linkedBranch": {"id": 2, "ref": {"name": "my-branch"} } } } }`, func(inputs map[string]interface{}) { - + assert.Equal(t, "REPOID", inputs["repositoryId"]) + assert.Equal(t, "my-branch", inputs["name"]) + assert.Equal(t, "yar", inputs["issueId"]) }), )