-
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.
fix: adminCreateUser correct response
Also start refactoring to use the aws-sdk types to avoid these issues in the future. Fixes #38
- Loading branch information
Showing
12 changed files
with
104 additions
and
74 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,49 @@ | ||
import { ClockFake } from "../../src/__tests__/clockFake"; | ||
import { UUID } from "../../src/__tests__/patterns"; | ||
import { withCognitoSdk } from "./setup"; | ||
|
||
const currentDate = new Date(); | ||
const roundedDate = new Date(currentDate.getTime()); | ||
roundedDate.setMilliseconds(0); | ||
|
||
const clock = new ClockFake(currentDate); | ||
|
||
describe( | ||
"CognitoIdentityServiceProvider.adminCreateUser", | ||
withCognitoSdk( | ||
(Cognito) => { | ||
it("creates a user with only the required parameters", async () => { | ||
const client = Cognito(); | ||
|
||
const createUserResult = await client | ||
.adminCreateUser({ | ||
Username: "abc", | ||
UserPoolId: "test", | ||
|
||
// TODO: shouldn't need to supply this | ||
TemporaryPassword: "TemporaryPassword", | ||
}) | ||
.promise(); | ||
|
||
expect(createUserResult).toEqual({ | ||
User: { | ||
Attributes: [ | ||
{ | ||
Name: "sub", | ||
Value: expect.stringMatching(UUID), | ||
}, | ||
], | ||
Enabled: true, | ||
UserCreateDate: roundedDate, | ||
UserLastModifiedDate: roundedDate, | ||
UserStatus: "CONFIRMED", | ||
Username: "abc", | ||
}, | ||
}); | ||
}); | ||
}, | ||
{ | ||
clock, | ||
} | ||
) | ||
); |
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
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