Skip to content

Commit

Permalink
Changes based on PR review
Browse files Browse the repository at this point in the history
  • Loading branch information
iartemiev committed Aug 23, 2019
1 parent 6494cdd commit 6048436
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
8 changes: 4 additions & 4 deletions packages/auth/__tests__/auth-unit-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -854,11 +854,11 @@ describe('auth unit test', () => {
Pool: userPool
});

const error = new AuthError(AuthErrorTypes.EmptyPassword);
const errorMessage = new AuthError(AuthErrorTypes.EmptyPassword);

expect.assertions(2);
await expect(auth.completeNewPassword(user, null, {}).then()).rejects.toThrow(AuthError);
await expect(auth.completeNewPassword(user, null, {}).then()).rejects.toEqual(error);
await expect(auth.completeNewPassword(user, null, {}).then()).rejects.toEqual(errorMessage);
});
});

Expand Down Expand Up @@ -1303,11 +1303,11 @@ describe('auth unit test', () => {
Username: 'username',
Pool: userPool
});
const error = new AuthError(AuthErrorTypes.EmptyCode);
const errorMessage = new AuthError(AuthErrorTypes.EmptyCode);

expect.assertions(2);
expect(auth.verifyUserAttributeSubmit(user, {}, null).then()).rejects.toThrow(AuthError);
expect(auth.verifyUserAttributeSubmit(user, {}, null).then()).rejects.toEqual(error);
expect(auth.verifyUserAttributeSubmit(user, {}, null).then()).rejects.toEqual(errorMessage);
});
});

Expand Down
5 changes: 3 additions & 2 deletions packages/auth/src/Errors.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* Copyright 2019-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
Expand Down Expand Up @@ -54,7 +54,7 @@ export const authErrorMessages: AuthErrorMessages = {
log: `
Error: Amplify has not been configured correctly.
This error is typically caused by one of the following scenarios:
1. Make sure you're passing the awsconfig object to Amplify.configure() in your app's entry point
See https://aws-amplify.github.io/docs/js/authentication#configure-your-app for more information
Expand All @@ -74,6 +74,7 @@ export const authErrorMessages: AuthErrorMessages = {
emptyUsername: {
message: 'Username cannot be empty'
},
// TODO: should include a list of valid sign-in types
invalidUsername: {
message:
'The username should either be a string or one of the sign in types'
Expand Down
2 changes: 1 addition & 1 deletion packages/auth/src/types/Auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ export enum AuthErrorTypes {
Default = 'default'
}

export type AuthErrorMessages = { [key in AuthErrorTypes]?: AuthErrorMessage };
export type AuthErrorMessages = { [key in AuthErrorTypes]: AuthErrorMessage };

export interface AuthErrorMessage {
message: string;
Expand Down

0 comments on commit 6048436

Please sign in to comment.