Skip to content

Commit

Permalink
fix: auth unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
akshbhu committed Sep 12, 2022
1 parent 0ba4d4d commit f884422
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
/* eslint-disable @typescript-eslint/no-non-null-assertion */
/* eslint-disable max-lines-per-function */
import * as cdk from '@aws-cdk/core';
import * as iam from '@aws-cdk/aws-iam';
import { FeatureFlags } from 'amplify-cli-core';
import * as cdk from '@aws-cdk/core';
import { AmplifyAuthCognitoStack } from '../../../../provider-utils/awscloudformation/auth-stack-builder/auth-cognito-stack-builder';
import { AuthStackSynthesizer } from '../../../../provider-utils/awscloudformation/auth-stack-builder/stack-synthesizer';
import { CognitoStackOptions } from '../../../../provider-utils/awscloudformation/service-walkthrough-types/cognito-user-input-types';
import { AttributeType } from '../../../../provider-utils/awscloudformation/service-walkthrough-types/awsCognito-user-input-types';
import { CognitoStackOptions } from '../../../../provider-utils/awscloudformation/service-walkthrough-types/cognito-user-input-types';

describe('generateCognitoStackResources', () => {
const props: CognitoStackOptions = {
Expand Down Expand Up @@ -111,7 +110,7 @@ describe('generateCognitoStackResources', () => {
});
const updatedProps: CognitoStackOptions = {
...props,
autoVerifiedAttributes: [AttributeType.PHONE_NUMBER],
userAutoVerifiedAttributeUpdateSettings: [AttributeType.PHONE_NUMBER],
};
cognitoStack.generateCognitoStackResources(updatedProps);
expect(cognitoStack.userPool?.userAttributeUpdateSettings).toMatchInlineSnapshot(`
Expand All @@ -130,15 +129,16 @@ describe('generateCognitoStackResources', () => {
});
const updatedProps: CognitoStackOptions = {
...props,
autoVerifiedAttributes: [AttributeType.EMAIL],
userAutoVerifiedAttributeUpdateSettings: [AttributeType.EMAIL],
};
cognitoStack.generateCognitoStackResources(updatedProps);
expect(cognitoStack.userPool?.userAttributeUpdateSettings).toMatchInlineSnapshot(`
Object {
"attributesRequireVerificationBeforeUpdate": Array [
"email",
],
}
}
`);
cognitoStack.generateCognitoStackResources(props);
expect(cognitoStack.userPool!.lambdaConfig).toHaveProperty('preSignUp');
expect(cognitoStack.userPoolClientWeb!.tokenValidityUnits).toHaveProperty('refreshToken');
Expand Down

0 comments on commit f884422

Please sign in to comment.