Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
lankalana committed Oct 3, 2024
1 parent e19c1df commit 3721148
Show file tree
Hide file tree
Showing 135 changed files with 1,708 additions and 1,718 deletions.
42 changes: 19 additions & 23 deletions integration-tests/aws-sdk/addCustomAttributes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,35 +8,31 @@ describe(
const client = Cognito();

// create the user pool client
const up = await client
.createUserPool({
PoolName: "pool",
});
const up = await client.createUserPool({
PoolName: "pool",
});

const describeResponse = await client
.describeUserPool({
UserPoolId: up.UserPool?.Id!,
});
const describeResponse = await client.describeUserPool({
UserPoolId: up.UserPool?.Id,
});

expect(describeResponse.UserPool).toMatchObject({
SchemaAttributes: USER_POOL_AWS_DEFAULTS.SchemaAttributes,
});

await client
.addCustomAttributes({
UserPoolId: up.UserPool?.Id!,
CustomAttributes: [
{
AttributeDataType: "String",
Name: "test",
},
],
});
await client.addCustomAttributes({
UserPoolId: up.UserPool?.Id,
CustomAttributes: [
{
AttributeDataType: "String",
Name: "test",
},
],
});

const describeResponseAfterUpdate = await client
.describeUserPool({
UserPoolId: up.UserPool?.Id!,
});
const describeResponseAfterUpdate = await client.describeUserPool({
UserPoolId: up.UserPool?.Id,
});

expect(describeResponseAfterUpdate.UserPool).toMatchObject({
SchemaAttributes: [
Expand All @@ -52,5 +48,5 @@ describe(
],
});
});
})
}),
);
55 changes: 25 additions & 30 deletions integration-tests/aws-sdk/adminConfirmSignUp.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,41 +6,36 @@ describe(
it("confirms a user", async () => {
const client = Cognito();

const upc = await client
.createUserPoolClient({
UserPoolId: "test",
ClientName: "test",
});

await client
.signUp({
UserAttributes: [{ Name: "phone_number", Value: "0400000000" }],
Username: "abc",
ClientId: upc.UserPoolClient?.ClientId!,
Password: "def",
});

let user = await client
.adminGetUser({
UserPoolId: "test",
Username: "abc",
});
const upc = await client.createUserPoolClient({
UserPoolId: "test",
ClientName: "test",
});

await client.signUp({
UserAttributes: [{ Name: "phone_number", Value: "0400000000" }],
Username: "abc",
ClientId: upc.UserPoolClient?.ClientId,
Password: "def",
});

let user = await client.adminGetUser({
UserPoolId: "test",
Username: "abc",
});

expect(user.UserStatus).toEqual("UNCONFIRMED");

await client
.adminConfirmSignUp({
UserPoolId: "test",
Username: "abc",
});
await client.adminConfirmSignUp({
UserPoolId: "test",
Username: "abc",
});

user = await client
.adminGetUser({
UserPoolId: "test",
Username: "abc",
});
user = await client.adminGetUser({
UserPoolId: "test",
Username: "abc",
});

expect(user.UserStatus).toEqual("CONFIRMED");
});
})
}),
);
50 changes: 23 additions & 27 deletions integration-tests/aws-sdk/adminDeleteUserAttributes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,46 +7,42 @@ describe(
it("updates a user's attributes", async () => {
const client = Cognito();

await client
.adminCreateUser({
UserAttributes: [
{ Name: "email", Value: "[email protected]" },
{ Name: "custom:example", Value: "1" },
],
Username: "abc",
UserPoolId: "test",
DesiredDeliveryMediums: ["EMAIL"],
});
await client.adminCreateUser({
UserAttributes: [
{ Name: "email", Value: "[email protected]" },
{ Name: "custom:example", Value: "1" },
],
Username: "abc",
UserPoolId: "test",
DesiredDeliveryMediums: ["EMAIL"],
});

let user = await client
.adminGetUser({
UserPoolId: "test",
Username: "abc",
});
let user = await client.adminGetUser({
UserPoolId: "test",
Username: "abc",
});

expect(user.UserAttributes).toEqual([
{ Name: "sub", Value: expect.stringMatching(UUID) },
{ Name: "email", Value: "[email protected]" },
{ Name: "custom:example", Value: "1" },
]);

await client
.adminDeleteUserAttributes({
UserPoolId: "test",
Username: "abc",
UserAttributeNames: ["custom:example"],
});
await client.adminDeleteUserAttributes({
UserPoolId: "test",
Username: "abc",
UserAttributeNames: ["custom:example"],
});

user = await client
.adminGetUser({
UserPoolId: "test",
Username: "abc",
});
user = await client.adminGetUser({
UserPoolId: "test",
Username: "abc",
});

expect(user.UserAttributes).toEqual([
{ Name: "sub", Value: expect.stringMatching(UUID) },
{ Name: "email", Value: "[email protected]" },
]);
});
})
}),
);
39 changes: 18 additions & 21 deletions integration-tests/aws-sdk/adminDisableUser.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,27 @@ describe(
it("updates a user's attributes", async () => {
const client = Cognito();

await client
.adminCreateUser({
UserAttributes: [
{ Name: "email", Value: "[email protected]" },
{ Name: "custom:example", Value: "1" },
],
Username: "abc",
UserPoolId: "test",
DesiredDeliveryMediums: ["EMAIL"],
});
await client.adminCreateUser({
UserAttributes: [
{ Name: "email", Value: "[email protected]" },
{ Name: "custom:example", Value: "1" },
],
Username: "abc",
UserPoolId: "test",
DesiredDeliveryMediums: ["EMAIL"],
});

await client
.adminDisableUser({
UserPoolId: "test",
Username: "abc",
});
await client.adminDisableUser({
UserPoolId: "test",
Username: "abc",
});

const user = await client
.adminGetUser({
UserPoolId: "test",
Username: "abc",
});
const user = await client.adminGetUser({
UserPoolId: "test",
Username: "abc",
});

expect(user.Enabled).toEqual(false);
});
})
}),
);
61 changes: 28 additions & 33 deletions integration-tests/aws-sdk/adminEnableUser.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,44 +6,39 @@ describe(
it("updates a user's attributes", async () => {
const client = Cognito();

await client
.adminCreateUser({
UserAttributes: [
{ Name: "email", Value: "[email protected]" },
{ Name: "custom:example", Value: "1" },
],
Username: "abc",
UserPoolId: "test",
DesiredDeliveryMediums: ["EMAIL"],
});

await client
.adminDisableUser({
UserPoolId: "test",
Username: "abc",
});

let user = await client
.adminGetUser({
UserPoolId: "test",
Username: "abc",
});
await client.adminCreateUser({
UserAttributes: [
{ Name: "email", Value: "[email protected]" },
{ Name: "custom:example", Value: "1" },
],
Username: "abc",
UserPoolId: "test",
DesiredDeliveryMediums: ["EMAIL"],
});

await client.adminDisableUser({
UserPoolId: "test",
Username: "abc",
});

let user = await client.adminGetUser({
UserPoolId: "test",
Username: "abc",
});

expect(user.Enabled).toEqual(false);

await client
.adminEnableUser({
UserPoolId: "test",
Username: "abc",
});
await client.adminEnableUser({
UserPoolId: "test",
Username: "abc",
});

user = await client
.adminGetUser({
UserPoolId: "test",
Username: "abc",
});
user = await client.adminGetUser({
UserPoolId: "test",
Username: "abc",
});

expect(user.Enabled).toEqual(true);
});
})
}),
);
Loading

0 comments on commit 3721148

Please sign in to comment.