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'
},
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'
}
}
};

View file

@ -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;

View file

@ -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,