diff --git a/jest.config.js b/jest.config.js index ac8208423..efec3da84 100644 --- a/jest.config.js +++ b/jest.config.js @@ -31,5 +31,5 @@ module.exports = { }, }, // Uncomment this to avoid the massive amount of warnings we are getting for onSubmit and onInvalidSubmit - silent: true, + //silent: true, }; diff --git a/src/constants/service-type.js b/src/constants/service-type.js new file mode 100644 index 000000000..5cb6a277a --- /dev/null +++ b/src/constants/service-type.js @@ -0,0 +1,6 @@ +const serviceType = { + REPLACEMENT: "replacement", + REPAIR: "repair", + REPLACEMENT_AND_RECALIBRATION: "replacement and recalibration", +}; +export { serviceType }; diff --git a/src/digital-components/modal/modal.vue b/src/digital-components/modal/modal.vue index e0353829c..0fed54f45 100644 --- a/src/digital-components/modal/modal.vue +++ b/src/digital-components/modal/modal.vue @@ -22,7 +22,7 @@ @mousedown="closeModal" aria-label="Close"> - -
+
-
+
-
+
{ } }); - // it("getFullMonthName should return full month format.", () => { - // // Arrange / Act - // const date = new Date("2023-10-01"); - // const monthName = getFullMonthName(date); + it("getDateFormat should return date in the given format.", () => { + // Arrange / Act + const dateString = "2023-10-01"; + const dateParts = dateString.split("-"); + const date = new Date(dateParts[0], parseInt(dateParts[1]) - 1, dateParts[2]); + const format = "yyyy-MM-dd"; + const formattedDate = getDateFormat(date, format); - // // Assert - // expect(monthName).toEqual("October"); - // }); - - // it("getFullDayName should return full Day Name format.", () => { - // // Arrange / Act - // const date = new Date("2023-10-01"); - // const dayName = getFullDayName(date); - - // // Assert - // expect(dayName).toEqual("Sunday"); - // }); - - // it("getDateFormat should return date in the given format.", () => { - // // Arrange / Act - // const date = new Date("2023-10-01"); - // const format = "yyyy-MM-dd"; - // const formattedDate = getDateFormat(date, format); - - // // Assert - // expect(formattedDate).toEqual("2023-10-01"); - // }); + // Assert + expect(formattedDate).toEqual("2023-10-01"); + }); it("should return the correct difference in days", function () { // Define some sample dates and their expected differences diff --git a/src/layouts/add-to-calendar/add-to-calendar.spec.js b/src/layouts/add-to-calendar/add-to-calendar.spec.js index 1e3e5ae4e..645e3b12f 100644 --- a/src/layouts/add-to-calendar/add-to-calendar.spec.js +++ b/src/layouts/add-to-calendar/add-to-calendar.spec.js @@ -77,9 +77,9 @@ describe("Add-to-calendar methods...", () => { //Assert expect(wrapper.vm.$refs.calendarModalQuestion.openModal).toBeCalled(); }); - test("serviceType should return 'replacement and recalibration' when isRepair and funnelHasRecalibrationPart true.", () => { + test("serviceType should return 'replacement and recalibration' when isRepair is false and funnelHasRecalibrationPart true.", () => { //Arrange - store.getters.order.damage.isRepair = true; + store.getters.order.damage.isRepair = false; store.getters.funnelHasRecalibrationPart = true; const { wrapper } = setupMocks({}); @@ -89,9 +89,9 @@ describe("Add-to-calendar methods...", () => { //Assert expect(testValue).toEqual("replacement and recalibration"); }); - test("serviceType should return 'replacement' when isRepair is true and funnelHasRecalibrationPart is false.", () => { + test("serviceType should return 'replacement' when isRepair is false and funnelHasRecalibrationPart is false.", () => { //Arrange - store.getters.order.damage.isRepair = true; + store.getters.order.damage.isRepair = false; store.getters.funnelHasRecalibrationPart = false; const { wrapper } = setupMocks({}); @@ -101,9 +101,9 @@ describe("Add-to-calendar methods...", () => { //Assert expect(testValue).toEqual("replacement"); }); - test("serviceType should return 'repair' when isRepair is false.", () => { + test("serviceType should return 'repair' when isRepair is true.", () => { //Arrange - store.getters.order.damage.isRepair = false; + store.getters.order.damage.isRepair = true; const { wrapper } = setupMocks({}); //Act @@ -126,7 +126,7 @@ describe("Add-to-calendar methods...", () => { test("getappointmentData should return expected model value for appointmentType mobile.", () => { //Arrange store.getters.order.serviceLocation.appointmentType = AppointmentTypeStrings.MOBILE; - store.getters.order.damage.isRepair = true; + store.getters.order.damage.isRepair = false; store.getters.funnelHasRecalibrationPart = true; const { wrapper } = setupMocks({}); @@ -176,7 +176,7 @@ describe("Add-to-calendar methods...", () => { test("getappointmentData should return expected model value for appointmentType DROP_OFF.", () => { //Arrange store.getters.order.serviceLocation.appointmentType = AppointmentTypeStrings.DROP_OFF; - store.getters.order.damage.isRepair = false; + store.getters.order.damage.isRepair = true; const { wrapper } = setupMocks({}); //Act @@ -188,7 +188,7 @@ describe("Add-to-calendar methods...", () => { test("getappointmentData should return expected model value for appointmentType IN_SHOP.", () => { //Arrange store.getters.order.serviceLocation.appointmentType = AppointmentTypeStrings.IN_SHOP; - store.getters.order.damage.isRepair = false; + store.getters.order.damage.isRepair = true; const { wrapper } = setupMocks({}); //Act @@ -239,12 +239,6 @@ function setupMocks({ customMountOptions }) { }); const wrapper = shallowMount(addToCalendar, mountOptions); - - //wrapper.vm.setCmsContent = jest.fn(); - //wrapper.vm.$refs.datePicker.initializeComponent = jest.fn(); - //wrapper.vm.$refs.locationAlerts.initializeComponent = jest.fn(); - //wrapper.vm.$refs.funnelFooter.updateButtonText = jest.fn(); wrapper.vm.$refs.calendarModalQuestion.openModal = jest.fn(); - return { wrapper }; } diff --git a/src/layouts/add-to-calendar/add-to-calendar.vue b/src/layouts/add-to-calendar/add-to-calendar.vue index b0306b5d0..3f32a525b 100644 --- a/src/layouts/add-to-calendar/add-to-calendar.vue +++ b/src/layouts/add-to-calendar/add-to-calendar.vue @@ -32,6 +32,7 @@ import { import { getCalendarFile, download } from "@/helpers/add-to-calendar-helper"; import { AppointmentTypeStrings, RouteCodeFlags } from "@/constants/schedule-constants"; import store from "@/store"; +import { serviceType } from "@/constants/service-type"; export default { name: "add-to-calendar", @@ -127,14 +128,14 @@ export default { serviceType() { const isRepair = store.getters.order.damage.isRepair; const funnelHasRecalibrationPart = store.getters.funnelHasRecalibrationPart; - if (isRepair) { + if (!isRepair) { if (funnelHasRecalibrationPart) { - return "replacement and recalibration"; + return serviceType.REPLACEMENT_AND_RECALIBRATION; } else { - return "replacement"; + return serviceType.REPLACEMENT; } } - return "repair"; + return serviceType.REPAIR; }, routeCode() { return store.getters.order.schedule.routeCode; diff --git a/src/layouts/address-lookup/address-lookup.vue b/src/layouts/address-lookup/address-lookup.vue index 08833dc2c..de0e8d5aa 100644 --- a/src/layouts/address-lookup/address-lookup.vue +++ b/src/layouts/address-lookup/address-lookup.vue @@ -11,7 +11,7 @@
-
+
-
+
-
+
@@ -55,15 +55,11 @@ import { fetchCmsContentForPage } from "@/helpers/cms-content-helper"; import { AppointmentTypeStrings } from "@/constants/schedule-constants"; import { settleAllPromises } from "@/helpers/layout-helper"; import { applicationConfig } from "@/constants/application-config.js"; +import { convertDateStringToDate } from "@/layouts/schedule/helpers/schedule-helper"; import { Form } from "vee-validate"; import store from "@/store"; -import { - getFullDayName, - getFullMonthName, - get12HourTimeFormat, - get12HourTimeMobileFormat, -} from "@/helpers/date-helper"; +import { get12HourTimeFormat, get12HourTimeMobileFormat } from "@/helpers/date-helper"; export default { name: "confirmation", async beforeRouteEnter(to, from, next) { @@ -174,10 +170,14 @@ export default { return `${this.ProviderAddress},
${this.ProviderCity}, ${this.ProviderState} ${this.ProviderZipCode}`; }, ScheduleDateFormatted() { - const scheduleDate = new Date(this.ScheduleDate); - return `${getFullDayName(scheduleDate)}, ${getFullMonthName( - scheduleDate - )} ${scheduleDate.getDate()}`; + // This conversion ensures we don't get get GMT induced date changes + const dateObject = convertDateStringToDate(this.ScheduleDate); + // Ex: Tuesday, April 22 + return dateObject.toLocaleDateString("en-us", { + weekday: "long", + month: "long", + day: "numeric", + }); }, ScheduleTimeFormatted() { if (this.AppointmentType == AppointmentTypeStrings.MOBILE) { diff --git a/src/layouts/customer-details/customer-details.vue b/src/layouts/customer-details/customer-details.vue index 9568b2a13..6e5fc0f09 100644 --- a/src/layouts/customer-details/customer-details.vue +++ b/src/layouts/customer-details/customer-details.vue @@ -6,7 +6,7 @@
-
+
-
+
@@ -33,12 +33,13 @@
-
+
-
+
-
-
+
-
+