forked from jagregory/cognito-local
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(userpool): force save sub as attribute, fix sub check logic
- Loading branch information
Showing
2 changed files
with
32 additions
and
11 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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import { createUserPool } from "../src/services/userPool"; | ||
import { createUserPool, UserPool } from "../src/services/userPool"; | ||
import fs from "fs"; | ||
import { promisify } from "util"; | ||
|
||
|
@@ -26,7 +26,7 @@ describe("User Pool", () => { | |
}); | ||
|
||
describe("saveUser", () => { | ||
it("saves a user", async () => { | ||
it("saves a user with their username as an additional attribute", async () => { | ||
const now = new Date().getTime(); | ||
const dataStore = await createUserPool({ UsernameAttributes: [] }, path); | ||
|
||
|
@@ -49,7 +49,10 @@ describe("User Pool", () => { | |
Username: "1", | ||
Password: "hunter3", | ||
UserStatus: "UNCONFIRMED", | ||
Attributes: [{ Name: "email", Value: "[email protected]" }], | ||
Attributes: [ | ||
{ Name: "sub", Value: "1" }, | ||
{ Name: "email", Value: "[email protected]" }, | ||
], | ||
UserLastModifiedDate: now, | ||
UserCreateDate: now, | ||
Enabled: true, | ||
|
@@ -83,7 +86,10 @@ describe("User Pool", () => { | |
Password: "hunter3", | ||
UserStatus: "UNCONFIRMED", | ||
ConfirmationCode: "1234", | ||
Attributes: [{ Name: "email", Value: "[email protected]" }], | ||
Attributes: [ | ||
{ Name: "sub", Value: "1" }, | ||
{ Name: "email", Value: "[email protected]" }, | ||
], | ||
UserLastModifiedDate: now, | ||
UserCreateDate: now, | ||
Enabled: true, | ||
|
@@ -110,7 +116,10 @@ describe("User Pool", () => { | |
Username: "1", | ||
Password: "hunter3", | ||
UserStatus: "CONFIRMED", | ||
Attributes: [{ Name: "email", Value: "[email protected]" }], | ||
Attributes: [ | ||
{ Name: "sub", Value: "1" }, | ||
{ Name: "email", Value: "[email protected]" }, | ||
], | ||
UserLastModifiedDate: now, | ||
UserCreateDate: now, | ||
Enabled: true, | ||
|
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