From 4d220cac90d93b73d6f9c06f9960bd2e663114c9 Mon Sep 17 00:00:00 2001
From: John Cruz <jcruz@flexion.us>
Date: Thu, 12 Dec 2024 14:39:10 -0700
Subject: [PATCH] 10553: Extend coverage on "verifyUserPendingEmailAction";

---
 .../verifyUserPendingEmailAction.test.tsx     | 37 ++++++++++++++++++-
 1 file changed, 36 insertions(+), 1 deletion(-)

diff --git a/web-client/src/presenter/actions/verifyUserPendingEmailAction.test.tsx b/web-client/src/presenter/actions/verifyUserPendingEmailAction.test.tsx
index a56ff71a1de..d91e5fc7853 100644
--- a/web-client/src/presenter/actions/verifyUserPendingEmailAction.test.tsx
+++ b/web-client/src/presenter/actions/verifyUserPendingEmailAction.test.tsx
@@ -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';
@@ -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 });
@@ -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.',
+      },
+    });
+  });
 });