This repository has been archived by the owner on Nov 15, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ee3a627
commit a73c433
Showing
1 changed file
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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) | ||
|
||
|