Skip to content

Commit

Permalink
10553: Extend coverage on "verifyUserPendingEmailAction";
Browse files Browse the repository at this point in the history
  • Loading branch information
John Cruz committed Dec 12, 2024
1 parent 557e861 commit 4d220ca
Showing 1 changed file with 36 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { GatewayTimeoutError } from '@web-client/presenter/errors/GatewayTimeoutError';
import { TROUBLESHOOTING_INFO } from '@shared/business/entities/EntityConstants';
import { applicationContextForClient as applicationContext } from '@web-client/test/createClientTestApplicationContext';
import { presenter } from '../presenter-mock';
Expand All @@ -20,15 +21,20 @@ describe('verifyUserPendingEmailAction', () => {
});

it('should return a success message when the user`s pending email is successfully verified', async () => {
await runAction(verifyUserPendingEmailAction, {
const { state } = await runAction(verifyUserPendingEmailAction, {
modules: {
presenter,
},
props: {
token: mockToken,
},
state: {
alertInfo: 'TEST_ALERT_INFO',
},
});

expect(state.alertInfo).toBeUndefined();

expect(
applicationContext.getUseCases().verifyUserPendingEmailInteractor,
).toHaveBeenCalledWith(expect.anything(), { token: mockToken });
Expand Down Expand Up @@ -100,4 +106,33 @@ describe('verifyUserPendingEmailAction', () => {
},
});
});

it('should return an error message when the request timed out', async () => {
applicationContext
.getUseCases()
.verifyUserPendingEmailInteractor.mockRejectedValue(
new GatewayTimeoutError(),
);

await runAction(verifyUserPendingEmailAction, {
modules: {
presenter,
},
props: {
token: mockToken,
},
});

expect(errorMock).toHaveBeenCalledWith({
alertError: {
message: (
<>
DAWSON is updating your other contact information. Please wait and
try to verify your email in a few minutes.
</>
),
title: 'DAWSON can’t verify your email right now.',
},
});
});
});

0 comments on commit 4d220ca

Please sign in to comment.