Vehicle damage changes
This commit is contained in:
parent
786f785e79
commit
e4349b3a3d
4 changed files with 24 additions and 11 deletions
|
|
@ -173,9 +173,10 @@ describe("vehicle-damage.vue", () => {
|
||||||
//Assert
|
//Assert
|
||||||
expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalled();
|
expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalled();
|
||||||
expect(wrapper.vm.selectedGlassToReplace()).toEqual(expectedGlassToReplace);
|
expect(wrapper.vm.selectedGlassToReplace()).toEqual(expectedGlassToReplace);
|
||||||
expect(baseMixin.methods.dispatchStoreAction).toBeCalledWith(
|
expect(baseMixin.methods.dispatchStoreActionWithLogging).toBeCalledWith(
|
||||||
storeActions.GET_DAMAGE_OPTIONS,
|
storeActions.GET_DAMAGE_OPTIONS,
|
||||||
{ carId: "C00000000" }
|
{ carId: "C00000000" },
|
||||||
|
"vehicle-damage"
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -268,9 +269,10 @@ describe("vehicle-damage.vue", () => {
|
||||||
//Assert
|
//Assert
|
||||||
expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalled();
|
expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalled();
|
||||||
expect(wrapper.vm.selectedGlassToReplace()).toEqual(expectedGlassToReplace);
|
expect(wrapper.vm.selectedGlassToReplace()).toEqual(expectedGlassToReplace);
|
||||||
expect(baseMixin.methods.dispatchStoreAction).toBeCalledWith(
|
expect(baseMixin.methods.dispatchStoreActionWithLogging).toBeCalledWith(
|
||||||
storeActions.GET_DAMAGE_OPTIONS,
|
storeActions.GET_DAMAGE_OPTIONS,
|
||||||
{ carId: "C00000000" }
|
{ carId: "C00000000" },
|
||||||
|
"vehicle-damage"
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
@ -789,6 +791,7 @@ function setupMocks({ pageHeaderWidgetHeaderText, mountOptionsMockData, funnelCo
|
||||||
mountOptionsMockData = Object.assign(mountOptionsMockDataDefault, mountOptionsMockData);
|
mountOptionsMockData = Object.assign(mountOptionsMockDataDefault, mountOptionsMockData);
|
||||||
//Mock api responses
|
//Mock api responses
|
||||||
baseMixin.methods.dispatchStoreAction = jest.fn();
|
baseMixin.methods.dispatchStoreAction = jest.fn();
|
||||||
|
baseMixin.methods.dispatchStoreActionWithLogging = jest.fn();
|
||||||
const apiResponses = {
|
const apiResponses = {
|
||||||
cmsContent: {
|
cmsContent: {
|
||||||
FunnelSubHeaderWidget: pageHeaderWidgetHeaderText,
|
FunnelSubHeaderWidget: pageHeaderWidgetHeaderText,
|
||||||
|
|
|
||||||
|
|
@ -90,9 +90,10 @@ export default {
|
||||||
// Call APIs
|
// Call APIs
|
||||||
const cmsContentPromise = fetchCmsContentForPage(to.query.fmgPage);
|
const cmsContentPromise = fetchCmsContentForPage(to.query.fmgPage);
|
||||||
|
|
||||||
const damageOptionsPromise = baseMixin.methods.dispatchStoreAction(
|
const damageOptionsPromise = baseMixin.methods.dispatchStoreActionWithLogging(
|
||||||
storeActions.GET_DAMAGE_OPTIONS,
|
storeActions.GET_DAMAGE_OPTIONS,
|
||||||
{ carId: store.getters.vehicle.carId }
|
{ carId: store.getters.vehicle.carId },
|
||||||
|
"vehicle-damage"
|
||||||
);
|
);
|
||||||
|
|
||||||
// Settle promises and get results
|
// Settle promises and get results
|
||||||
|
|
@ -325,8 +326,10 @@ export default {
|
||||||
);
|
);
|
||||||
|
|
||||||
if (this.isWindshieldRepair) {
|
if (this.isWindshieldRepair) {
|
||||||
const supportingItems = await this.dispatchStoreAction(
|
const supportingItems = await this.dispatchStoreActionWithLogging(
|
||||||
storeActions.GET_SUPPORTING_ITEMS
|
storeActions.GET_SUPPORTING_ITEMS,
|
||||||
|
null,
|
||||||
|
"vehicle-damage"
|
||||||
);
|
);
|
||||||
this.dispatchStoreAction(
|
this.dispatchStoreAction(
|
||||||
this.storeActions.SAVE_SUPPORTING_ITEMS,
|
this.storeActions.SAVE_SUPPORTING_ITEMS,
|
||||||
|
|
|
||||||
|
|
@ -776,13 +776,15 @@ export const actions = {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
getDamageOptions(context, { carId }) {
|
getDamageOptions(context, { payload: { carId }, pageNameToLog }) {
|
||||||
return globalMethods.callHttpClient({
|
return globalMethods.callHttpClient({
|
||||||
methods: endpoints.GetDamageOptions.method,
|
methods: endpoints.GetDamageOptions.method,
|
||||||
endpoint: `${endpoints.GetDamageOptions.url}/${carId}`,
|
endpoint: `${endpoints.GetDamageOptions.url}/${carId}`,
|
||||||
payload: {},
|
payload: {},
|
||||||
additionalSuccessEventDataHandler: (response) =>
|
additionalSuccessEventDataHandler: (response) =>
|
||||||
"QueryStringZip: " + getQuerystringParameter(queryStrings.ZIP_CODE),
|
"QueryStringZip: " + getQuerystringParameter(queryStrings.ZIP_CODE),
|
||||||
|
logApiCall: true,
|
||||||
|
pageNameToLog: pageNameToLog,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -1232,7 +1234,7 @@ export const actions = {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
getSupportingItems(context) {
|
getSupportingItems(context, { pageNameToLog }) {
|
||||||
const glassPartsArray = context.getters.lineItems.glassParts ?? [];
|
const glassPartsArray = context.getters.lineItems.glassParts ?? [];
|
||||||
const carId = context.getters.vehicle.carId;
|
const carId = context.getters.vehicle.carId;
|
||||||
const isRepair = context.getters.damage.isRepair;
|
const isRepair = context.getters.damage.isRepair;
|
||||||
|
|
@ -1248,6 +1250,8 @@ export const actions = {
|
||||||
parts: glassPartsArray,
|
parts: glassPartsArray,
|
||||||
numberOfRepairChips: isRepair ? numberOfChips : 0,
|
numberOfRepairChips: isRepair ? numberOfChips : 0,
|
||||||
},
|
},
|
||||||
|
logApiCall: true,
|
||||||
|
pageNameToLog: pageNameToLog,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -549,7 +549,10 @@ describe("Actions", () => {
|
||||||
return Promise.resolve({ data: ["Windshield", "DriversFrontDoor"] });
|
return Promise.resolve({ data: ["Windshield", "DriversFrontDoor"] });
|
||||||
});
|
});
|
||||||
|
|
||||||
const response = await actions.getDamageOptions(context, "C00000000");
|
const response = await actions.getDamageOptions(context, {
|
||||||
|
payload: { carId: "C00000000" },
|
||||||
|
pageNameToLog: "test",
|
||||||
|
});
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
expect(response.data).toEqual(["Windshield", "DriversFrontDoor"]);
|
expect(response.data).toEqual(["Windshield", "DriversFrontDoor"]);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue