-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(@aws-amplify/auth): Ignores case when converting strings to boole…
…ans for user attributes (#8206)
- Loading branch information
Showing
2 changed files
with
46 additions
and
3 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 |
---|---|---|
|
@@ -3089,7 +3089,7 @@ describe('auth unit test', () => { | |
spyon.mockClear(); | ||
}); | ||
|
||
test('happy case with unverified', async () => { | ||
test('happy case with verified', async () => { | ||
const spyon = jest | ||
.spyOn(Auth.prototype, 'userAttributes') | ||
.mockImplementationOnce(() => { | ||
|
@@ -3128,6 +3128,46 @@ describe('auth unit test', () => { | |
|
||
spyon.mockClear(); | ||
}); | ||
|
||
test('happy case with verified as strings', async () => { | ||
const spyon = jest | ||
.spyOn(Auth.prototype, 'userAttributes') | ||
.mockImplementationOnce(() => { | ||
return new Promise((res: any, rej) => { | ||
res([ | ||
{ | ||
Name: 'email', | ||
Value: '[email protected]', | ||
}, | ||
{ | ||
Name: 'phone_number', | ||
Value: '+12345678901', | ||
}, | ||
{ | ||
Name: 'email_verified', | ||
Value: 'true', | ||
}, | ||
{ | ||
Name: 'phone_number_verified', | ||
Value: 'True', | ||
}, | ||
]); | ||
}); | ||
}); | ||
|
||
const auth = new Auth(authOptions); | ||
const user = new CognitoUser({ | ||
Username: 'username', | ||
Pool: userPool, | ||
}); | ||
|
||
expect(await auth.verifiedContact(user)).toEqual({ | ||
unverified: {}, | ||
verified: { email: '[email protected]', phone_number: '+12345678901' }, | ||
}); | ||
|
||
spyon.mockClear(); | ||
}); | ||
}); | ||
|
||
describe('currentUserPoolUser test', () => { | ||
|
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