Skip to content
This repository has been archived by the owner on Nov 15, 2022. It is now read-only.

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
lucassabreu committed Jul 31, 2018
1 parent ee3a627 commit a73c433
Showing 1 changed file with 77 additions and 0 deletions.
77 changes: 77 additions & 0 deletions server/graphql/graphql_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1049,6 +1049,83 @@ func TestMutations(t *testing.T) {
},
}

m.On("Update", oUpdated).Once().
Return(oUpdated, nil)

return m
}(),
},
"organizationUpdate/without_complement": testCase{
token: dToken,
mutation: `mutation {
viewer {
organizationUpdate(input: {
name: "new name",
address: {
withoutComplement: true
}
}) {
organization {
name, address {complement}
}
}
}
}`,
response: `{"data":{"viewer":{"organizationUpdate":{"organization":{
"id" : 1,"name": "new name", "about": "old about", "phone": "",
"video": "http://video.com/wv", "email": "[email protected]",
"address" : {
"street": "Rua Algum Lugar (Nova)", "number": "500",
"neighbordhood": "Algum Bairro Antigo", "city": "Curitiba",
"state": "PR", "zipcode": "90230000", "complement": "Perto do Obelisco"
}
}}}}}`,
orgRepoMock: func() *orgRepoMock {
m := &orgRepoMock{}
m.On("Get", int64(1)).Once().
Return(
&model.Organization{
User: model.User{
ID: 1,
Email: "[email protected]",
},
Name: "old name",
About: "old about",
Phone: "",
Video: "http://video.com/wv",
Address: model.Address{
Street: "Rua Algum Lugar",
Number: "500",
Neighborhood: "Algum Bairro Antigo",
City: "Curitiba",
State: "PR",
Zipcode: "90230000",
Complement: nulls.NewString("Perto do Obelisco"),
},
},
nil,
)

oUpdated := model.Organization{
User: model.User{
ID: 1,
Email: "[email protected]",
},
Name: "new name",
About: "old about",
Phone: "",
Video: "http://video.com/wv",
Address: model.Address{
Street: "Rua Algum Lugar (Nova)",
Number: "500",
Neighborhood: "Algum Bairro Antigo",
City: "Curitiba",
State: "PR",
Zipcode: "90230000",
Complement: nulls.NewString("Perto do Obelisco"),
},
}

m.On("Update", oUpdated).Once().
Return(oUpdated, nil)

Expand Down

0 comments on commit a73c433

Please sign in to comment.