From d9b5902ea4acb3728cfa6702b982fb43a5424380 Mon Sep 17 00:00:00 2001
From: CarlNation <32103961+CarlNation@users.noreply.github.com>
Date: Mon, 26 Feb 2024 09:35:33 -0500
Subject: [PATCH 1/4] CSR-1855
CSR-1855 route to a bailout page when an api call returns a 500. 500 errors cause the current page to hang.
---
src/global-methods.js | 3 +-
src/layouts/bailout/bailout.vue | 79 +++++++++++++++++++++++++++++++++
src/router/index.js | 11 ++++-
3 files changed, 91 insertions(+), 2 deletions(-)
create mode 100644 src/layouts/bailout/bailout.vue
diff --git a/src/global-methods.js b/src/global-methods.js
index f2821343d..6d0fc7c0c 100644
--- a/src/global-methods.js
+++ b/src/global-methods.js
@@ -51,6 +51,7 @@ export default {
},
(error) => {
console.error(error);
+ console.log("Error calling: " + endpoint + " payload: " + JSON.stringify(payload));
if (logApiCall) {
analyticsMixIn.methods.pushEventToGA(
@@ -61,7 +62,7 @@ export default {
);
}
- //router.navigateError();
+ router.navigateError();
return reject(error.response);
}
);
diff --git a/src/layouts/bailout/bailout.vue b/src/layouts/bailout/bailout.vue
new file mode 100644
index 000000000..bbd1670c3
--- /dev/null
+++ b/src/layouts/bailout/bailout.vue
@@ -0,0 +1,79 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/src/router/index.js b/src/router/index.js
index 2373b6e48..1af870e72 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -32,8 +32,14 @@ import analyticsMixin from "@/mixins/analytics-mixin";
import { experimentTriggers } from "../constants/experiments";
import { applicationConfig } from "../constants/application-config";
import { shouldStripPromoQueryString } from "@/helpers/promotions-helper";
+import bailout from "@/layouts/bailout/bailout";
const routes = [
+ {
+ path: "/bailout",
+ name: "bailout",
+ component: bailout,
+ },
{
path: "/",
name: "root",
@@ -436,7 +442,10 @@ async function DisplayPageError() {
);
baseMixin.methods.dispatchStoreAction(storeActions.RESET_SAVE_SESSION_PROMISE);
- location.reload();
+ router.push({
+ path: "/",
+ query: { fmgPage: 'bailout' },
+ });
}
function isExistingFmgPageName(pageName) {
From e6b2a95f14d3f85be37d081108ef7fd929a0a359 Mon Sep 17 00:00:00 2001
From: CarlNation
Date: Mon, 26 Feb 2024 09:40:30 -0500
Subject: [PATCH 2/4] prettier
---
src/global-methods.js | 1 -
src/layouts/bailout/bailout.vue | 2 +-
src/router/index.js | 4 ++--
3 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/src/global-methods.js b/src/global-methods.js
index 6d0fc7c0c..c5e6102dc 100644
--- a/src/global-methods.js
+++ b/src/global-methods.js
@@ -51,7 +51,6 @@ export default {
},
(error) => {
console.error(error);
- console.log("Error calling: " + endpoint + " payload: " + JSON.stringify(payload));
if (logApiCall) {
analyticsMixIn.methods.pushEventToGA(
diff --git a/src/layouts/bailout/bailout.vue b/src/layouts/bailout/bailout.vue
index bbd1670c3..a7cf017b4 100644
--- a/src/layouts/bailout/bailout.vue
+++ b/src/layouts/bailout/bailout.vue
@@ -76,4 +76,4 @@ export default {
loadingModal,
},
};
-
\ No newline at end of file
+
diff --git a/src/router/index.js b/src/router/index.js
index 1af870e72..e489cbfca 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -39,7 +39,7 @@ const routes = [
path: "/bailout",
name: "bailout",
component: bailout,
- },
+ },
{
path: "/",
name: "root",
@@ -444,7 +444,7 @@ async function DisplayPageError() {
baseMixin.methods.dispatchStoreAction(storeActions.RESET_SAVE_SESSION_PROMISE);
router.push({
path: "/",
- query: { fmgPage: 'bailout' },
+ query: { fmgPage: "bailout" },
});
}
From 92a5411f2939cb57fc156f8c3fd7f44cb14cdc20 Mon Sep 17 00:00:00 2001
From: CarlNation
Date: Mon, 26 Feb 2024 12:53:59 -0500
Subject: [PATCH 3/4] CSR-1855
bailout spec
---
src/layouts/bailout/bailout.spec.js | 48 +++++++++++++++++++++++++++++
1 file changed, 48 insertions(+)
create mode 100644 src/layouts/bailout/bailout.spec.js
diff --git a/src/layouts/bailout/bailout.spec.js b/src/layouts/bailout/bailout.spec.js
new file mode 100644
index 000000000..ebed2697a
--- /dev/null
+++ b/src/layouts/bailout/bailout.spec.js
@@ -0,0 +1,48 @@
+// Components
+import bailout from "@/layouts/bailout/bailout.vue";
+
+// Supporting Files
+import { shallowMount } from "@vue/test-utils";
+import { getMountOptions } from "@/helpers/unit-test-helper.js";
+
+// Mock our module for promises.
+jest.mock("@/helpers/layout-helper.js", () => ({
+ settleAllPromises: jest.fn(),
+}));
+
+// Mock fetchCmsContentForPage
+jest.mock("@/helpers/cms-content-helper", () => ({
+ fetchCmsContentForPage: jest.fn(),
+}));
+
+describe("bailout.vue", () => {
+ test("arePagePrerequisitesValid should be true ", async () => {
+ //Arrange
+ const { wrapper } = setupMocks();
+
+ //Act
+ let arePagePrerequisitesValid = wrapper.vm.arePagePrerequisitesValid();
+
+ //Assert
+ expect(arePagePrerequisitesValid).toBe(true);
+ });
+});
+
+function setupMocks() {
+ const mountOptions = getMountOptions({});
+
+ //Mock props
+ const mockMixin = {
+ methods: {
+ getCmsContent: jest.fn(),
+ },
+ };
+
+ mountOptions.mixins = [mockMixin];
+ const wrapper = shallowMount(bailout, mountOptions);
+
+ wrapper.vm.setCmsContent = jest.fn();
+ wrapper.vm.backButtonAction = jest.fn();
+
+ return { wrapper };
+}
From 1200ded61db27feb7f072a3a6465ed5eea9886fd Mon Sep 17 00:00:00 2001
From: CarlNation
Date: Mon, 26 Feb 2024 15:03:42 -0500
Subject: [PATCH 4/4] CSR-1855 test fix
CSR-1855 test fix
---
src/global-methods.spec.js | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/global-methods.spec.js b/src/global-methods.spec.js
index b74b97a8a..ab80bcd7b 100644
--- a/src/global-methods.spec.js
+++ b/src/global-methods.spec.js
@@ -1,6 +1,7 @@
import globalMethods from "@/global-methods";
import axios from "axios";
import analyticsMixIn from "@/mixins/analytics-mixin";
+import router from "@/router";
//Mock external dependencies
jest.mock("axios");
@@ -29,6 +30,7 @@ it("Global Methods - Call Http Client - Should Reject Promise", () => {
isError: true,
});
analyticsMixIn.methods.pushEventToGA = jest.fn();
+ router.navigateError = jest.fn();
//Act
globalMethods.callHttpClient(httpArgs).catch((err) => {