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
|
||||
expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalled();
|
||||
expect(wrapper.vm.selectedGlassToReplace()).toEqual(expectedGlassToReplace);
|
||||
expect(baseMixin.methods.dispatchStoreAction).toBeCalledWith(
|
||||
expect(baseMixin.methods.dispatchStoreActionWithLogging).toBeCalledWith(
|
||||
storeActions.GET_DAMAGE_OPTIONS,
|
||||
{ carId: "C00000000" }
|
||||
{ carId: "C00000000" },
|
||||
"vehicle-damage"
|
||||
);
|
||||
});
|
||||
|
||||
|
|
@ -268,9 +269,10 @@ describe("vehicle-damage.vue", () => {
|
|||
//Assert
|
||||
expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalled();
|
||||
expect(wrapper.vm.selectedGlassToReplace()).toEqual(expectedGlassToReplace);
|
||||
expect(baseMixin.methods.dispatchStoreAction).toBeCalledWith(
|
||||
expect(baseMixin.methods.dispatchStoreActionWithLogging).toBeCalledWith(
|
||||
storeActions.GET_DAMAGE_OPTIONS,
|
||||
{ carId: "C00000000" }
|
||||
{ carId: "C00000000" },
|
||||
"vehicle-damage"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
@ -789,6 +791,7 @@ function setupMocks({ pageHeaderWidgetHeaderText, mountOptionsMockData, funnelCo
|
|||
mountOptionsMockData = Object.assign(mountOptionsMockDataDefault, mountOptionsMockData);
|
||||
//Mock api responses
|
||||
baseMixin.methods.dispatchStoreAction = jest.fn();
|
||||
baseMixin.methods.dispatchStoreActionWithLogging = jest.fn();
|
||||
const apiResponses = {
|
||||
cmsContent: {
|
||||
FunnelSubHeaderWidget: pageHeaderWidgetHeaderText,
|
||||
|
|
|
|||
|
|
@ -90,9 +90,10 @@ export default {
|
|||
// Call APIs
|
||||
const cmsContentPromise = fetchCmsContentForPage(to.query.fmgPage);
|
||||
|
||||
const damageOptionsPromise = baseMixin.methods.dispatchStoreAction(
|
||||
const damageOptionsPromise = baseMixin.methods.dispatchStoreActionWithLogging(
|
||||
storeActions.GET_DAMAGE_OPTIONS,
|
||||
{ carId: store.getters.vehicle.carId }
|
||||
{ carId: store.getters.vehicle.carId },
|
||||
"vehicle-damage"
|
||||
);
|
||||
|
||||
// Settle promises and get results
|
||||
|
|
@ -325,8 +326,10 @@ export default {
|
|||
);
|
||||
|
||||
if (this.isWindshieldRepair) {
|
||||
const supportingItems = await this.dispatchStoreAction(
|
||||
storeActions.GET_SUPPORTING_ITEMS
|
||||
const supportingItems = await this.dispatchStoreActionWithLogging(
|
||||
storeActions.GET_SUPPORTING_ITEMS,
|
||||
null,
|
||||
"vehicle-damage"
|
||||
);
|
||||
this.dispatchStoreAction(
|
||||
this.storeActions.SAVE_SUPPORTING_ITEMS,
|
||||
|
|
|
|||
|
|
@ -776,13 +776,15 @@ export const actions = {
|
|||
});
|
||||
},
|
||||
|
||||
getDamageOptions(context, { carId }) {
|
||||
getDamageOptions(context, { payload: { carId }, pageNameToLog }) {
|
||||
return globalMethods.callHttpClient({
|
||||
methods: endpoints.GetDamageOptions.method,
|
||||
endpoint: `${endpoints.GetDamageOptions.url}/${carId}`,
|
||||
payload: {},
|
||||
additionalSuccessEventDataHandler: (response) =>
|
||||
"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 carId = context.getters.vehicle.carId;
|
||||
const isRepair = context.getters.damage.isRepair;
|
||||
|
|
@ -1248,6 +1250,8 @@ export const actions = {
|
|||
parts: glassPartsArray,
|
||||
numberOfRepairChips: isRepair ? numberOfChips : 0,
|
||||
},
|
||||
logApiCall: true,
|
||||
pageNameToLog: pageNameToLog,
|
||||
});
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -549,7 +549,10 @@ describe("Actions", () => {
|
|||
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
|
||||
expect(response.data).toEqual(["Windshield", "DriversFrontDoor"]);
|
||||
|
|
|
|||
Loading…
Reference in a new issue