From 51f93741048a7ede8bb04d2d6bbeea67baca1191 Mon Sep 17 00:00:00 2001 From: Scott Kiener Date: Wed, 18 Sep 2024 11:36:47 -0400 Subject: [PATCH] CSR-1804 | Unit test and formatting changes --- src/global-methods.js | 5 ++++- .../mobile-location-modal-questions.spec.js | 4 ++++ .../mobile-location-modal-questions.vue | 7 ++++++- .../service-zip-modal-question.spec.js | 4 ++++ .../service-zip-modal-question.vue | 9 +++++++-- src/store/index.js | 5 +++-- 6 files changed, 28 insertions(+), 6 deletions(-) diff --git a/src/global-methods.js b/src/global-methods.js index c286ede9b..ba534eeab 100644 --- a/src/global-methods.js +++ b/src/global-methods.js @@ -56,7 +56,10 @@ export default { additionalSuccessEventDataHandler, }) { return new Promise((resolve, reject) => { - const cfDistroUrl = applicationConfig.CONSUMER_CF_DISTRO; + let cfDistroUrl = applicationConfig.CONSUMER_CF_DISTRO; + if (endpoint.includes("/order/")) { + cfDistroUrl = "https://localhost:44346"; + } const payloadAndAnalyticsData = Object.assign({}, payload, { AppName: "FixMyGlass" }); const headers = { [headerKeys.EXPERIMENT]: JSON.stringify(store.getters.experimentSettings), diff --git a/src/layouts/service-location/mobile-location-modal-questions/mobile-location-modal-questions.spec.js b/src/layouts/service-location/mobile-location-modal-questions/mobile-location-modal-questions.spec.js index 56833dbaa..863a04c82 100644 --- a/src/layouts/service-location/mobile-location-modal-questions/mobile-location-modal-questions.spec.js +++ b/src/layouts/service-location/mobile-location-modal-questions/mobile-location-modal-questions.spec.js @@ -2,6 +2,7 @@ import mobileLocationModalQuestions from "./mobile-location-modal-questions"; import { mount, shallowMount } from "@vue/test-utils"; import { storeActions } from "@/constants/store-actions"; import { getMountOptions } from "@/helpers/unit-test-helper.js"; +import { getBillToAccountNumber } from "../helpers/service-location-helper/service-location-helper"; const linkWidgetName = "linkWidgetName"; const modalWidgetName = "modalWidgetName"; @@ -125,6 +126,9 @@ jest.mock( getServiceabilityDetails: jest.fn((mockServiceZipCode) => { return mockGetServiceabilityDetails(mockServiceZipCode); }), + getBillToAccountNumber: jest.fn(() => { + return "87291"; + }), }) ); diff --git a/src/layouts/service-location/mobile-location-modal-questions/mobile-location-modal-questions.vue b/src/layouts/service-location/mobile-location-modal-questions/mobile-location-modal-questions.vue index 40fc698ac..89e095279 100644 --- a/src/layouts/service-location/mobile-location-modal-questions/mobile-location-modal-questions.vue +++ b/src/layouts/service-location/mobile-location-modal-questions/mobile-location-modal-questions.vue @@ -92,7 +92,12 @@ import { v4 as uuidv4 } from "uuid"; export default { name: "mobile-location-modal-questions", - emits: ["update:modelValue", "updated-mobile-fee-part", "updated-contains-military-base", "updated-bill-to-account-number"], + emits: [ + "update:modelValue", + "updated-mobile-fee-part", + "updated-contains-military-base", + "updated-bill-to-account-number", + ], data() { return { internalModel: deepClone(this.modelValue), diff --git a/src/layouts/service-location/service-zip-modal-question/service-zip-modal-question.spec.js b/src/layouts/service-location/service-zip-modal-question/service-zip-modal-question.spec.js index 7c09836fe..ed8a811ed 100644 --- a/src/layouts/service-location/service-zip-modal-question/service-zip-modal-question.spec.js +++ b/src/layouts/service-location/service-zip-modal-question/service-zip-modal-question.spec.js @@ -1,5 +1,6 @@ import { mount, shallowMount } from "@vue/test-utils"; import serviceZipModalQuestion from "./service-zip-modal-question"; +import { getBillToAccountNumber } from "../helpers/service-location-helper/service-location-helper"; jest.mock("@/digital-components/textbox-question/textbox-question", () => ({ getCmsContent: jest.fn((widgetName, cmsFieldName) => { @@ -51,6 +52,9 @@ jest.mock( getServiceabilityDetails: jest.fn((mockServiceZipCode) => { return mockGetServiceabilityDetails(mockServiceZipCode); }), + getBillToAccountNumber: jest.fn((mockServiceZipCodeCtu) => { + return "87291"; + }), }) ); diff --git a/src/layouts/service-location/service-zip-modal-question/service-zip-modal-question.vue b/src/layouts/service-location/service-zip-modal-question/service-zip-modal-question.vue index 5272ab52e..c0231ea80 100644 --- a/src/layouts/service-location/service-zip-modal-question/service-zip-modal-question.vue +++ b/src/layouts/service-location/service-zip-modal-question/service-zip-modal-question.vue @@ -46,12 +46,17 @@ import alert from "@/ux-components/alert/alert"; import { getPricedMobileFeePart, getServiceabilityDetails, - getBillToAccountNumber + getBillToAccountNumber, } from "@/layouts/service-location/helpers/service-location-helper/service-location-helper"; export default { name: "service-zip-modal-question", - emits: ["update:modelValue", "updated-mobile-fee-part", "updated-contains-military-base", "updated-bill-to-account-number"], + emits: [ + "update:modelValue", + "updated-mobile-fee-part", + "updated-contains-military-base", + "updated-bill-to-account-number", + ], data() { return { internalModel: this.copyModel(this.modelValue), diff --git a/src/store/index.js b/src/store/index.js index 6cd534730..6faeab921 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -2422,8 +2422,9 @@ export const actions = { })); const order = context.getters.order; - - var providerNumber = order.serviceLocation?.provider?.providerNumber ?? order.serviceLocation?.zipCodeCtu; + + var providerNumber = + order.serviceLocation?.provider?.providerNumber ?? order.serviceLocation?.zipCodeCtu; if (providerNumber.startsWith("00") && providerNumber.length > 5) { providerNumber = providerNumber.substring(1); }