service-type constant file

service-type constant file added
This commit is contained in:
hiteshkumar87 2023-10-16 17:54:54 +05:30
parent aefac08554
commit 1c48dc856a
3 changed files with 19 additions and 18 deletions

View file

@ -0,0 +1,6 @@
const serviceType = {
REPLACEMENT: "replacement",
REPAIR: "repair",
REPLACEMENT_AND_RECALIBRATION: "replacement and recalibration",
};
export { serviceType };

View file

@ -77,9 +77,9 @@ describe("Add-to-calendar methods...", () => {
//Assert //Assert
expect(wrapper.vm.$refs.calendarModalQuestion.openModal).toBeCalled(); 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 //Arrange
store.getters.order.damage.isRepair = true; store.getters.order.damage.isRepair = false;
store.getters.funnelHasRecalibrationPart = true; store.getters.funnelHasRecalibrationPart = true;
const { wrapper } = setupMocks({}); const { wrapper } = setupMocks({});
@ -89,9 +89,9 @@ describe("Add-to-calendar methods...", () => {
//Assert //Assert
expect(testValue).toEqual("replacement and recalibration"); 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 //Arrange
store.getters.order.damage.isRepair = true; store.getters.order.damage.isRepair = false;
store.getters.funnelHasRecalibrationPart = false; store.getters.funnelHasRecalibrationPart = false;
const { wrapper } = setupMocks({}); const { wrapper } = setupMocks({});
@ -101,9 +101,9 @@ describe("Add-to-calendar methods...", () => {
//Assert //Assert
expect(testValue).toEqual("replacement"); expect(testValue).toEqual("replacement");
}); });
test("serviceType should return 'repair' when isRepair is false.", () => { test("serviceType should return 'repair' when isRepair is true.", () => {
//Arrange //Arrange
store.getters.order.damage.isRepair = false; store.getters.order.damage.isRepair = true;
const { wrapper } = setupMocks({}); const { wrapper } = setupMocks({});
//Act //Act
@ -126,7 +126,7 @@ describe("Add-to-calendar methods...", () => {
test("getappointmentData should return expected model value for appointmentType mobile.", () => { test("getappointmentData should return expected model value for appointmentType mobile.", () => {
//Arrange //Arrange
store.getters.order.serviceLocation.appointmentType = AppointmentTypeStrings.MOBILE; store.getters.order.serviceLocation.appointmentType = AppointmentTypeStrings.MOBILE;
store.getters.order.damage.isRepair = true; store.getters.order.damage.isRepair = false;
store.getters.funnelHasRecalibrationPart = true; store.getters.funnelHasRecalibrationPart = true;
const { wrapper } = setupMocks({}); const { wrapper } = setupMocks({});
@ -176,7 +176,7 @@ describe("Add-to-calendar methods...", () => {
test("getappointmentData should return expected model value for appointmentType DROP_OFF.", () => { test("getappointmentData should return expected model value for appointmentType DROP_OFF.", () => {
//Arrange //Arrange
store.getters.order.serviceLocation.appointmentType = AppointmentTypeStrings.DROP_OFF; store.getters.order.serviceLocation.appointmentType = AppointmentTypeStrings.DROP_OFF;
store.getters.order.damage.isRepair = false; store.getters.order.damage.isRepair = true;
const { wrapper } = setupMocks({}); const { wrapper } = setupMocks({});
//Act //Act
@ -188,7 +188,7 @@ describe("Add-to-calendar methods...", () => {
test("getappointmentData should return expected model value for appointmentType IN_SHOP.", () => { test("getappointmentData should return expected model value for appointmentType IN_SHOP.", () => {
//Arrange //Arrange
store.getters.order.serviceLocation.appointmentType = AppointmentTypeStrings.IN_SHOP; store.getters.order.serviceLocation.appointmentType = AppointmentTypeStrings.IN_SHOP;
store.getters.order.damage.isRepair = false; store.getters.order.damage.isRepair = true;
const { wrapper } = setupMocks({}); const { wrapper } = setupMocks({});
//Act //Act
@ -239,12 +239,6 @@ function setupMocks({ customMountOptions }) {
}); });
const wrapper = shallowMount(addToCalendar, mountOptions); 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(); wrapper.vm.$refs.calendarModalQuestion.openModal = jest.fn();
return { wrapper }; return { wrapper };
} }

View file

@ -32,6 +32,7 @@ import {
import { getCalendarFile, download } from "@/helpers/add-to-calendar-helper"; import { getCalendarFile, download } from "@/helpers/add-to-calendar-helper";
import { AppointmentTypeStrings, RouteCodeFlags } from "@/constants/schedule-constants"; import { AppointmentTypeStrings, RouteCodeFlags } from "@/constants/schedule-constants";
import store from "@/store"; import store from "@/store";
import { serviceType } from "@/constants/service-type";
export default { export default {
name: "add-to-calendar", name: "add-to-calendar",
@ -129,12 +130,12 @@ export default {
const funnelHasRecalibrationPart = store.getters.funnelHasRecalibrationPart; const funnelHasRecalibrationPart = store.getters.funnelHasRecalibrationPart;
if (!isRepair) { if (!isRepair) {
if (funnelHasRecalibrationPart) { if (funnelHasRecalibrationPart) {
return "replacement and recalibration"; return serviceType.REPLACEMENT_AND_RECALIBRATION;
} else { } else {
return "replacement"; return serviceType.REPLACEMENT;
} }
} }
return "repair"; return serviceType.REPAIR;
}, },
routeCode() { routeCode() {
return store.getters.order.schedule.routeCode; return store.getters.order.schedule.routeCode;