-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add InviteUser with forceSendInvite bool and test (#464)
* add InviteUser with forceSendInvite bool and test * UserInvite mutation takes forceSendInvite input arg * inviteUser accepts bool arg, not bool pointer * Update .changes/unreleased/Refactor-20240905-144928.yaml --------- Co-authored-by: Kyle <[email protected]>
- Loading branch information
1 parent
b34ea51
commit a05d27a
Showing
5 changed files
with
40 additions
and
12 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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
kind: Refactor | ||
body: 'BREAKING CHANGE: new argument sendInvite added to UserInvite() method to force send a user invite e-mail' | ||
time: 2024-09-05T14:49:28.926087-05:00 |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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 |
---|---|---|
|
@@ -10,24 +10,48 @@ import ( | |
func TestInviteUser(t *testing.T) { | ||
// Arrange | ||
testRequest := autopilot.NewTestRequest( | ||
`mutation UserInvite($email:String!$input:UserInput!){userInvite(email: $email input: $input){user{id,email,htmlUrl,name,role},errors{message,path}}}`, | ||
`{"email": "[email protected]", "input": { "name": "Kyle Rockman", "skipWelcomeEmail": false }}`, | ||
`mutation UserInvite($email:String!$forceSendInvite:Boolean$input:UserInput!){userInvite(email: $email input: $input, forceSendInvite: $forceSendInvite){user{id,email,htmlUrl,name,role},errors{message,path}}}`, | ||
`{"email": "[email protected]", "input": { "name": "Kyle Rockman", "skipWelcomeEmail": false }, "forceSendInvite": true}`, | ||
`{"data": { "userInvite": { "user": {{ template "user_1" }}, "errors": [] }}}`, | ||
) | ||
|
||
client := BestTestClient(t, "user/invite", testRequest) | ||
// Act | ||
result, err := client.InviteUser("[email protected]", ol.UserInput{ | ||
userInput := ol.UserInput{ | ||
Name: ol.RefOf("Kyle Rockman"), | ||
SkipWelcomeEmail: ol.RefOf(false), | ||
}) | ||
} | ||
// Act | ||
result, err := client.InviteUser("[email protected]", userInput, true) | ||
// Assert | ||
autopilot.Ok(t, err) | ||
autopilot.Equals(t, id1, result.Id) | ||
autopilot.Equals(t, "Kyle Rockman", result.Name) | ||
autopilot.Equals(t, ol.UserRoleUser, result.Role) | ||
} | ||
|
||
func TestInviteUserSkipSendInvite(t *testing.T) { | ||
// Arrange | ||
testRequest := autopilot.NewTestRequest( | ||
`mutation UserInvite($email:String!$forceSendInvite:Boolean$input:UserInput!){userInvite(email: $email input: $input, forceSendInvite: $forceSendInvite){user{id,email,htmlUrl,name,role},errors{message,path}}}`, | ||
`{"email": "[email protected]", "input": { "name": "Kyle Rockman", "role": "team_member", "skipWelcomeEmail": false }, "forceSendInvite": false}`, | ||
`{"data": { "userInvite": { "user": { {{ template "user_id_email_1" }}, "name": "Kyle Rockman", "role": "team_member" }, "errors": [] }}}`, | ||
) | ||
|
||
client := BestTestClient(t, "user/invite_skip_send_invite", testRequest) | ||
userInput := ol.UserInput{ | ||
Name: ol.RefOf("Kyle Rockman"), | ||
Role: ol.RefOf(ol.UserRoleTeamMember), | ||
SkipWelcomeEmail: ol.RefOf(false), | ||
} | ||
// Act | ||
result, err := client.InviteUser("[email protected]", userInput, false) | ||
// Assert | ||
autopilot.Ok(t, err) | ||
autopilot.Equals(t, id1, result.Id) | ||
autopilot.Equals(t, "Kyle Rockman", result.Name) | ||
autopilot.Equals(t, ol.UserRoleTeamMember, result.Role) | ||
} | ||
|
||
func TestGetUser(t *testing.T) { | ||
// Arrange | ||
testRequest := autopilot.NewTestRequest( | ||
|