Make sure struct fields are public

This commit is contained in:
Chris Westra 2022-09-09 10:17:35 -04:00
parent 2e98e8a4a7
commit e1b83496fa
2 changed files with 7 additions and 8 deletions

View file

@ -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

View file

@ -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"])
}),
)