PR feedback refactoring, unit test fixes

This commit is contained in:
Katie Kroell 2024-03-05 14:05:00 -05:00
parent ddb49a8e7c
commit a1b6695522
3 changed files with 18 additions and 16 deletions

View file

@ -233,7 +233,7 @@ describe('OrderConfirmation.vue', () => {
endTime: '10:00' endTime: '10:00'
}, },
serviceLocation: { serviceLocation: {
appointmentType: 'Drop Off' appointmentType: 'Dropoff'
} }
} }
}; };
@ -300,7 +300,7 @@ describe('OrderConfirmation.vue', () => {
zipCode: '12345' zipCode: '12345'
} }
}, },
appointmentType: 'Drop Off' appointmentType: 'Dropoff'
} }
} }
}; };
@ -387,7 +387,7 @@ describe('OrderConfirmation.vue', () => {
zipCode: '12345' zipCode: '12345'
} }
}, },
appointmentType: 'Drop Off' appointmentType: 'Dropoff'
} }
} }
}; };

View file

@ -61,6 +61,7 @@ import { useMainStore } from '@/store';
import { get12HourTimeFormat, get12HourTimeMobileFormat, convertDateStringToDate, import { get12HourTimeFormat, get12HourTimeMobileFormat, convertDateStringToDate,
getDisplayTextForDurationLength } from '@/helpers/date-helper.js'; getDisplayTextForDurationLength } from '@/helpers/date-helper.js';
import { toTitleCase } from '@/helpers/text-helper.js'; import { toTitleCase } from '@/helpers/text-helper.js';
import { AppointmentTypeStrings } from '@/constants/schedule-constants';
export default { export default {
name: 'order-confirmation', name: 'order-confirmation',
@ -105,7 +106,7 @@ export default {
return this.getCmsContent('OrderConfirmationContent', 'Image'); return this.getCmsContent('OrderConfirmationContent', 'Image');
}, },
appointmentType() { appointmentType() {
return this.mainStore.order.serviceLocation.appointmentType.toUpperCase(); return this.mainStore.order.serviceLocation.appointmentType;
}, },
appointmentDate() { appointmentDate() {
return this.mainStore.order.schedule.date; return this.mainStore.order.schedule.date;
@ -179,17 +180,17 @@ export default {
}, },
appointmentWordingText() { appointmentWordingText() {
switch (this.appointmentType) { switch (this.appointmentType) {
case 'MOBILE': case AppointmentTypeStrings.MOBILE || AppointmentTypeStrings.MOBILE_NOT_ITAC_AND_NOT_NOCOMP:
return this.mobileWordingText?.replaceAll( return this.mobileWordingText?.replaceAll(
'{custom:address}', '{custom:address}',
this.serviceLocationFullAddress this.serviceLocationFullAddress
); );
case 'DROP OFF': case AppointmentTypeStrings.DROP_OFF:
return this.dropOffAndInShopWordingText?.replaceAll( return this.dropOffAndInShopWordingText?.replaceAll(
'{custom:address}', '{custom:address}',
this.providerFullAddress this.providerFullAddress
); );
case 'INSHOP': case AppointmentTypeStrings.IN_SHOP:
return this.dropOffAndInShopWordingText?.replaceAll( return this.dropOffAndInShopWordingText?.replaceAll(
'{custom:address}', '{custom:address}',
this.providerFullAddress this.providerFullAddress
@ -200,11 +201,11 @@ export default {
}, },
appointmentWordingText2() { appointmentWordingText2() {
switch (this.appointmentType) { switch (this.appointmentType) {
case 'MOBILE': case AppointmentTypeStrings.MOBILE || AppointmentTypeStrings.MOBILE_NOT_ITAC_AND_NOT_NOCOMP:
return this.mobileWordingText2; return this.mobileWordingText2;
case 'DROP OFF': case AppointmentTypeStrings.DROP_OFF:
return this.dropOffAndInShopWordingText2; return this.dropOffAndInShopWordingText2;
case 'INSHOP': case AppointmentTypeStrings.IN_SHOP:
return this.dropOffAndInShopWordingText2?.replaceAll( return this.dropOffAndInShopWordingText2?.replaceAll(
'{custom:inShopDuration}', '{custom:inShopDuration}',
this.inShopAppointmentDuration this.inShopAppointmentDuration
@ -214,13 +215,13 @@ export default {
} }
}, },
mobileAppointment() { mobileAppointment() {
return this.mainStore.order.serviceLocation.appointmentType.toUpperCase() === 'MOBILE'; return useMainStore().getters.isMobileAppointment;
}, },
inShopAppointment() { inShopAppointment() {
return this.mainStore.order.serviceLocation.appointmentType.toUpperCase() === 'INSHOP'; return useMainStore().getters.isInShopAppointment;
}, },
dropOffAppointment() { dropOffAppointment() {
return this.mainStore.order.serviceLocation.appointmentType.toUpperCase() === 'DROP OFF'; return useMainStore().getters.isDropOffAppointment;
}, },
inShopAppointmentDuration() { inShopAppointmentDuration() {
const inshopDurationTime = getDisplayTextForDurationLength( const inshopDurationTime = getDisplayTextForDurationLength(
@ -241,12 +242,12 @@ export default {
}, },
formatAppointmentTime(appointmentType) { formatAppointmentTime(appointmentType) {
switch (appointmentType) { switch (appointmentType) {
case 'MOBILE': case AppointmentTypeStrings.MOBILE || AppointmentTypeStrings.MOBILE_NOT_ITAC_AND_NOT_NOCOMP:
// eslint-disable-next-line max-len // eslint-disable-next-line max-len
return `Between ${get12HourTimeMobileFormat(this.appointmentStartTime)} - ${get12HourTimeMobileFormat(this.appointmentEndTime)}`; return `Between ${get12HourTimeMobileFormat(this.appointmentStartTime)} - ${get12HourTimeMobileFormat(this.appointmentEndTime)}`;
case 'DROP OFF': case AppointmentTypeStrings.DROP_OFF:
return 'Drop off before 9:30 AM'; return 'Drop off before 9:30 AM';
case 'INSHOP': case AppointmentTypeStrings.IN_SHOP:
return `at ${get12HourTimeFormat(this.appointmentStartTime)}`; return `at ${get12HourTimeFormat(this.appointmentStartTime)}`;
default: default:
return null; return null;

View file

@ -237,6 +237,7 @@ export const useMainStore = defineStore({
isMobileAppointment: (state) => state.order.serviceLocation.appointmentType === AppointmentTypeStrings.MOBILE isMobileAppointment: (state) => state.order.serviceLocation.appointmentType === AppointmentTypeStrings.MOBILE
|| state.order.serviceLocation.appointmentType === AppointmentTypeStrings.MOBILE_NOT_ITAC_AND_NOT_NOCOMP, || state.order.serviceLocation.appointmentType === AppointmentTypeStrings.MOBILE_NOT_ITAC_AND_NOT_NOCOMP,
isDropOffAppointment: (state) => state.order.serviceLocation.appointmentType === AppointmentTypeStrings.DROP_OFF, isDropOffAppointment: (state) => state.order.serviceLocation.appointmentType === AppointmentTypeStrings.DROP_OFF,
isInShopAppointment: (state) => state.order.serviceLocation.appointmentType === AppointmentTypeStrings.IN_SHOP,
isClaimRegistrationRequired: (state) => state.issConfig.isClaimRegistrationRequired, isClaimRegistrationRequired: (state) => state.issConfig.isClaimRegistrationRequired,
isClaimAlreadyRegistered: (state) => state.order.payment.insuranceCoverage.claimNumber !== null, isClaimAlreadyRegistered: (state) => state.order.payment.insuranceCoverage.claimNumber !== null,
isBailout: (state) => state.applicationUser.pageData[issPageValues.BAILOUT_PAGE] != null, isBailout: (state) => state.applicationUser.pageData[issPageValues.BAILOUT_PAGE] != null,