-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(api): adminCreateUser can generate a temporary password
- Loading branch information
Showing
7 changed files
with
38 additions
and
22 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
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
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
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 |
---|---|---|
|
@@ -58,6 +58,34 @@ describe("AdminCreateUser target", () => { | |
}); | ||
}); | ||
|
||
it("saves a new user with a generated temporary password", async () => { | ||
await adminCreateUser({ | ||
UserAttributes: [ | ||
{ Name: "email", Value: "[email protected]" }, | ||
{ Name: "phone_number", Value: "0400000000" }, | ||
], | ||
Username: "user-supplied", | ||
UserPoolId: "test", | ||
}); | ||
|
||
expect(mockUserPoolService.saveUser).toHaveBeenCalledWith({ | ||
Attributes: [ | ||
{ | ||
Name: "sub", | ||
Value: expect.stringMatching(UUID), | ||
}, | ||
{ Name: "email", Value: "[email protected]" }, | ||
{ Name: "phone_number", Value: "0400000000" }, | ||
], | ||
Enabled: true, | ||
Password: expect.stringMatching(/^[A-Za-z0-9!]{6}$/), | ||
UserCreateDate: originalDate, | ||
UserLastModifiedDate: originalDate, | ||
UserStatus: "FORCE_CHANGE_PASSWORD", | ||
Username: "user-supplied", | ||
}); | ||
}); | ||
|
||
describe("messages", () => { | ||
describe("DesiredDeliveryMediums=EMAIL", () => { | ||
it("sends a welcome email to the user", async () => { | ||
|
@@ -326,5 +354,4 @@ describe("AdminCreateUser target", () => { | |
}); | ||
|
||
it.todo("invokes the PreSignIn lambda"); | ||
it.todo("saves a user with a generated temporary password"); | ||
}); |
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