forked from ustaxcourt/ef-cms
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
10007: Fixing tests, update initiateAuth command that was missed in c…
…hange password interactor
- Loading branch information
1 parent
bf24e30
commit 8f01ddb
Showing
3 changed files
with
51 additions
and
79 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
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
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 |
---|---|---|
|
@@ -22,7 +22,7 @@ describe('loginInteractor', () => { | |
ChallengeName: ChallengeNameType.NEW_PASSWORD_REQUIRED, | ||
}; | ||
applicationContext | ||
.getCognito() | ||
.getUserGateway() | ||
.initiateAuth.mockResolvedValue(mockNewPasswordRequiredResponse); | ||
|
||
await expect( | ||
|
@@ -41,7 +41,7 @@ describe('loginInteractor', () => { | |
message: '', | ||
}); | ||
applicationContext | ||
.getCognito() | ||
.getUserGateway() | ||
.initiateAuth.mockRejectedValue(mockWrongEmailOrPasswordError); | ||
|
||
await expect( | ||
|
@@ -60,7 +60,7 @@ describe('loginInteractor', () => { | |
message: 'Password attempts exceeded', | ||
}); | ||
applicationContext | ||
.getCognito() | ||
.getUserGateway() | ||
.initiateAuth.mockRejectedValue(mockTooManyAttemptsError); | ||
|
||
await expect( | ||
|
@@ -79,7 +79,7 @@ describe('loginInteractor', () => { | |
message: '', | ||
}); | ||
applicationContext | ||
.getCognito() | ||
.getUserGateway() | ||
.initiateAuth.mockRejectedValue(mockWrongEmailOrPasswordError); | ||
|
||
await expect( | ||
|
@@ -97,7 +97,7 @@ describe('loginInteractor', () => { | |
'Totally unexpected, unhandled error.', | ||
); | ||
applicationContext | ||
.getCognito() | ||
.getUserGateway() | ||
.initiateAuth.mockRejectedValue(mockWrongEmailOrPasswordError); | ||
|
||
await expect( | ||
|
@@ -108,11 +108,11 @@ describe('loginInteractor', () => { | |
).rejects.toThrow(mockWrongEmailOrPasswordError); | ||
}); | ||
|
||
it('should throw an error if initiateAuth does not return access, id, and refresh tokens', async () => { | ||
it('should throw an error when initiateAuth does not return access, id, and refresh tokens', async () => { | ||
const mockEmail = '[email protected]'; | ||
const mockPassword = 'MyPa$Sword!'; | ||
applicationContext | ||
.getCognito() | ||
.getUserGateway() | ||
.initiateAuth.mockResolvedValue({ AuthenticationResult: {} }); | ||
|
||
await expect( | ||
|
@@ -131,7 +131,7 @@ describe('loginInteractor', () => { | |
message: '', | ||
}); | ||
applicationContext | ||
.getCognito() | ||
.getUserGateway() | ||
.initiateAuth.mockRejectedValue(mockWrongEmailOrPasswordError); | ||
applicationContext.getUserGateway().getUserByEmail.mockResolvedValue({ | ||
email: mockEmail, | ||
|
@@ -154,7 +154,7 @@ describe('loginInteractor', () => { | |
message: '', | ||
}); | ||
applicationContext | ||
.getCognito() | ||
.getUserGateway() | ||
.initiateAuth.mockRejectedValue(mockWrongEmailOrPasswordError); | ||
applicationContext | ||
.getUserGateway() | ||
|
@@ -182,7 +182,7 @@ describe('loginInteractor', () => { | |
}, | ||
}; | ||
applicationContext | ||
.getCognito() | ||
.getUserGateway() | ||
.initiateAuth.mockResolvedValue(mockSuccessFullLoginResponse); | ||
|
||
const result = await loginInteractor(applicationContext, { | ||
|