From a1b66955220c44c7bc272d858cc644d8db4ab272 Mon Sep 17 00:00:00 2001 From: Katie Kroell Date: Tue, 5 Mar 2024 14:05:00 -0500 Subject: [PATCH] PR feedback refactoring, unit test fixes --- .../order-confirmation.spec.js | 6 ++--- .../order-confirmation/order-confirmation.vue | 27 ++++++++++--------- src/store/index.js | 1 + 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/src/layouts/order-confirmation/order-confirmation.spec.js b/src/layouts/order-confirmation/order-confirmation.spec.js index d53eacbd..5883b9d1 100644 --- a/src/layouts/order-confirmation/order-confirmation.spec.js +++ b/src/layouts/order-confirmation/order-confirmation.spec.js @@ -233,7 +233,7 @@ describe('OrderConfirmation.vue', () => { endTime: '10:00' }, serviceLocation: { - appointmentType: 'Drop Off' + appointmentType: 'Dropoff' } } }; @@ -300,7 +300,7 @@ describe('OrderConfirmation.vue', () => { zipCode: '12345' } }, - appointmentType: 'Drop Off' + appointmentType: 'Dropoff' } } }; @@ -387,7 +387,7 @@ describe('OrderConfirmation.vue', () => { zipCode: '12345' } }, - appointmentType: 'Drop Off' + appointmentType: 'Dropoff' } } }; diff --git a/src/layouts/order-confirmation/order-confirmation.vue b/src/layouts/order-confirmation/order-confirmation.vue index 4b299b07..d6c7b2d2 100644 --- a/src/layouts/order-confirmation/order-confirmation.vue +++ b/src/layouts/order-confirmation/order-confirmation.vue @@ -61,6 +61,7 @@ import { useMainStore } from '@/store'; import { get12HourTimeFormat, get12HourTimeMobileFormat, convertDateStringToDate, getDisplayTextForDurationLength } from '@/helpers/date-helper.js'; import { toTitleCase } from '@/helpers/text-helper.js'; +import { AppointmentTypeStrings } from '@/constants/schedule-constants'; export default { name: 'order-confirmation', @@ -105,7 +106,7 @@ export default { return this.getCmsContent('OrderConfirmationContent', 'Image'); }, appointmentType() { - return this.mainStore.order.serviceLocation.appointmentType.toUpperCase(); + return this.mainStore.order.serviceLocation.appointmentType; }, appointmentDate() { return this.mainStore.order.schedule.date; @@ -179,17 +180,17 @@ export default { }, appointmentWordingText() { switch (this.appointmentType) { - case 'MOBILE': + case AppointmentTypeStrings.MOBILE || AppointmentTypeStrings.MOBILE_NOT_ITAC_AND_NOT_NOCOMP: return this.mobileWordingText?.replaceAll( '{custom:address}', this.serviceLocationFullAddress ); - case 'DROP OFF': + case AppointmentTypeStrings.DROP_OFF: return this.dropOffAndInShopWordingText?.replaceAll( '{custom:address}', this.providerFullAddress ); - case 'INSHOP': + case AppointmentTypeStrings.IN_SHOP: return this.dropOffAndInShopWordingText?.replaceAll( '{custom:address}', this.providerFullAddress @@ -200,11 +201,11 @@ export default { }, appointmentWordingText2() { switch (this.appointmentType) { - case 'MOBILE': + case AppointmentTypeStrings.MOBILE || AppointmentTypeStrings.MOBILE_NOT_ITAC_AND_NOT_NOCOMP: return this.mobileWordingText2; - case 'DROP OFF': + case AppointmentTypeStrings.DROP_OFF: return this.dropOffAndInShopWordingText2; - case 'INSHOP': + case AppointmentTypeStrings.IN_SHOP: return this.dropOffAndInShopWordingText2?.replaceAll( '{custom:inShopDuration}', this.inShopAppointmentDuration @@ -214,13 +215,13 @@ export default { } }, mobileAppointment() { - return this.mainStore.order.serviceLocation.appointmentType.toUpperCase() === 'MOBILE'; + return useMainStore().getters.isMobileAppointment; }, inShopAppointment() { - return this.mainStore.order.serviceLocation.appointmentType.toUpperCase() === 'INSHOP'; + return useMainStore().getters.isInShopAppointment; }, dropOffAppointment() { - return this.mainStore.order.serviceLocation.appointmentType.toUpperCase() === 'DROP OFF'; + return useMainStore().getters.isDropOffAppointment; }, inShopAppointmentDuration() { const inshopDurationTime = getDisplayTextForDurationLength( @@ -241,12 +242,12 @@ export default { }, formatAppointmentTime(appointmentType) { switch (appointmentType) { - case 'MOBILE': + case AppointmentTypeStrings.MOBILE || AppointmentTypeStrings.MOBILE_NOT_ITAC_AND_NOT_NOCOMP: // eslint-disable-next-line max-len return `Between ${get12HourTimeMobileFormat(this.appointmentStartTime)} - ${get12HourTimeMobileFormat(this.appointmentEndTime)}`; - case 'DROP OFF': + case AppointmentTypeStrings.DROP_OFF: return 'Drop off before 9:30 AM'; - case 'INSHOP': + case AppointmentTypeStrings.IN_SHOP: return `at ${get12HourTimeFormat(this.appointmentStartTime)}`; default: return null; diff --git a/src/store/index.js b/src/store/index.js index 5017c884..e34a7fcd 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -237,6 +237,7 @@ export const useMainStore = defineStore({ isMobileAppointment: (state) => state.order.serviceLocation.appointmentType === AppointmentTypeStrings.MOBILE || state.order.serviceLocation.appointmentType === AppointmentTypeStrings.MOBILE_NOT_ITAC_AND_NOT_NOCOMP, isDropOffAppointment: (state) => state.order.serviceLocation.appointmentType === AppointmentTypeStrings.DROP_OFF, + isInShopAppointment: (state) => state.order.serviceLocation.appointmentType === AppointmentTypeStrings.IN_SHOP, isClaimRegistrationRequired: (state) => state.issConfig.isClaimRegistrationRequired, isClaimAlreadyRegistered: (state) => state.order.payment.insuranceCoverage.claimNumber !== null, isBailout: (state) => state.applicationUser.pageData[issPageValues.BAILOUT_PAGE] != null,