Merge pull request #1174 from Safelite/feature/CSR-1148-tr
Tech Review: CSR-1148
This commit is contained in:
commit
f7c6723f38
2 changed files with 23 additions and 14 deletions
|
|
@ -341,14 +341,14 @@ export const mutations = {
|
||||||
state.order.schedule.routeCode = null;
|
state.order.schedule.routeCode = null;
|
||||||
state.order.schedule.jobMaxMinutes = null;
|
state.order.schedule.jobMaxMinutes = null;
|
||||||
|
|
||||||
//early bird fee used on schedule page also needs reset when schedule is reset
|
//premium appointment fee used on schedule page also needs reset when schedule is reset
|
||||||
const supportingItems = state.order.lineItems.supportingItems;
|
const supportingItems = state.order.lineItems.supportingItems;
|
||||||
const removeEarlyBirdIndex = supportingItems?.findIndex(
|
const premiumAppointmentFeeIndex = supportingItems?.findIndex(
|
||||||
(item) => item.partType == PREMIUM_FEE_PART_TYPE
|
(item) => item.partType == PREMIUM_FEE_PART_TYPE
|
||||||
);
|
);
|
||||||
|
|
||||||
if (removeEarlyBirdIndex >= 0) {
|
if (premiumAppointmentFeeIndex >= 0) {
|
||||||
supportingItems.splice(removeEarlyBirdIndex, 1);
|
supportingItems.splice(premiumAppointmentFeeIndex, 1);
|
||||||
state.order.lineItems.supportingItems = supportingItems;
|
state.order.lineItems.supportingItems = supportingItems;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -369,7 +369,6 @@ export const mutations = {
|
||||||
state.order.serviceLocation.address2 = null;
|
state.order.serviceLocation.address2 = null;
|
||||||
state.order.serviceLocation.city = null;
|
state.order.serviceLocation.city = null;
|
||||||
state.order.serviceLocation.state = null;
|
state.order.serviceLocation.state = null;
|
||||||
state.order.serviceLocation.zipCode = null;
|
|
||||||
state.order.serviceLocation.isVehicleProtected = null;
|
state.order.serviceLocation.isVehicleProtected = null;
|
||||||
},
|
},
|
||||||
// Misc Mutations
|
// Misc Mutations
|
||||||
|
|
@ -712,15 +711,16 @@ export const actions = {
|
||||||
// Dependency Actions
|
// Dependency Actions
|
||||||
resetDamageAndDependencies(context) {
|
resetDamageAndDependencies(context) {
|
||||||
context.commit(storeMutations.RESET_DAMAGE_STATE);
|
context.commit(storeMutations.RESET_DAMAGE_STATE);
|
||||||
context.commit(storeMutations.RESET_GLASS_PARTS_STATE);
|
|
||||||
context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, null);
|
context.dispatch(storeActions.RESET_PARTS_STATE_AND_DEPENDENCIES);
|
||||||
|
|
||||||
context.commit(storeMutations.UPDATE_VAPS, null);
|
context.commit(storeMutations.UPDATE_VAPS, null);
|
||||||
},
|
},
|
||||||
|
|
||||||
resetRegistrationAndDependencies(context) {
|
resetRegistrationAndDependencies(context) {
|
||||||
context.commit(storeMutations.RESET_REGISTRATION_STATE);
|
context.commit(storeMutations.RESET_REGISTRATION_STATE);
|
||||||
context.commit(storeMutations.RESET_GLASS_PARTS_STATE);
|
|
||||||
context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, null);
|
context.dispatch(storeActions.RESET_PARTS_STATE_AND_DEPENDENCIES);
|
||||||
},
|
},
|
||||||
|
|
||||||
resetPartsAndDependencies(context) {
|
resetPartsAndDependencies(context) {
|
||||||
|
|
@ -1606,7 +1606,6 @@ export const actions = {
|
||||||
|
|
||||||
if (!isSelectedGlassAvailableForVehicle) {
|
if (!isSelectedGlassAvailableForVehicle) {
|
||||||
context.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES);
|
context.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES);
|
||||||
context.dispatch(storeActions.RESET_PARTS_STATE_AND_DEPENDENCIES);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Save new values
|
//Save new values
|
||||||
|
|
@ -1632,7 +1631,6 @@ export const actions = {
|
||||||
|
|
||||||
if (!isSelectedGlassAvailableForVehicle) {
|
if (!isSelectedGlassAvailableForVehicle) {
|
||||||
context.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES);
|
context.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES);
|
||||||
context.dispatch(storeActions.RESET_PARTS_STATE_AND_DEPENDENCIES);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Save new values
|
//Save new values
|
||||||
|
|
@ -1658,6 +1656,8 @@ export const actions = {
|
||||||
);
|
);
|
||||||
|
|
||||||
if (havePartQuestionAnswersChanged) {
|
if (havePartQuestionAnswersChanged) {
|
||||||
|
context.dispatch(storeActions.RESET_SERVICE_LOCATION_STATE_AND_DEPENDENCIES);
|
||||||
|
|
||||||
context.commit(storeMutations.UPDATE_GLASS_PARTS, null);
|
context.commit(storeMutations.UPDATE_GLASS_PARTS, null);
|
||||||
context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, null);
|
context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, null);
|
||||||
context.commit(storeMutations.UPDATE_MOLDING_QUESTION_ANSWERS, null);
|
context.commit(storeMutations.UPDATE_MOLDING_QUESTION_ANSWERS, null);
|
||||||
|
|
@ -1705,6 +1705,8 @@ export const actions = {
|
||||||
previouslySelectedPartNumbers !== currentlySelectedPartNumbers;
|
previouslySelectedPartNumbers !== currentlySelectedPartNumbers;
|
||||||
|
|
||||||
if (haveSelectedVehiclePartsChanged) {
|
if (haveSelectedVehiclePartsChanged) {
|
||||||
|
context.dispatch(storeActions.RESET_SERVICE_LOCATION_STATE_AND_DEPENDENCIES);
|
||||||
|
|
||||||
context.commit(storeMutations.UPDATE_GLASS_PARTS, null);
|
context.commit(storeMutations.UPDATE_GLASS_PARTS, null);
|
||||||
context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, null);
|
context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, null);
|
||||||
context.commit(storeMutations.UPDATE_MOLDING_QUESTION_ANSWERS, null);
|
context.commit(storeMutations.UPDATE_MOLDING_QUESTION_ANSWERS, null);
|
||||||
|
|
@ -1736,6 +1738,8 @@ export const actions = {
|
||||||
);
|
);
|
||||||
|
|
||||||
if (haveMoldingQuestionAnswersChanged) {
|
if (haveMoldingQuestionAnswersChanged) {
|
||||||
|
context.dispatch(storeActions.RESET_SERVICE_LOCATION_STATE_AND_DEPENDENCIES);
|
||||||
|
|
||||||
context.commit(storeMutations.UPDATE_GLASS_PARTS, null);
|
context.commit(storeMutations.UPDATE_GLASS_PARTS, null);
|
||||||
context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, null);
|
context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, null);
|
||||||
context.commit(storeMutations.UPDATE_CAPABILITY_QUESTION_ANSWERS, null);
|
context.commit(storeMutations.UPDATE_CAPABILITY_QUESTION_ANSWERS, null);
|
||||||
|
|
@ -1765,6 +1769,8 @@ export const actions = {
|
||||||
);
|
);
|
||||||
|
|
||||||
if (haveCapabilityQuestionAnswersChanged) {
|
if (haveCapabilityQuestionAnswersChanged) {
|
||||||
|
context.dispatch(storeActions.RESET_SERVICE_LOCATION_STATE_AND_DEPENDENCIES);
|
||||||
|
|
||||||
context.commit(storeMutations.UPDATE_GLASS_PARTS, null);
|
context.commit(storeMutations.UPDATE_GLASS_PARTS, null);
|
||||||
context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, null);
|
context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, null);
|
||||||
}
|
}
|
||||||
|
|
@ -1897,7 +1903,6 @@ export const actions = {
|
||||||
if (vehicleInfo.vin !== context.state.order.vehicle.vin) {
|
if (vehicleInfo.vin !== context.state.order.vehicle.vin) {
|
||||||
if (!isSelectedGlassAvailableForVehicle) {
|
if (!isSelectedGlassAvailableForVehicle) {
|
||||||
context.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES);
|
context.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES);
|
||||||
context.dispatch(storeActions.RESET_PARTS_STATE_AND_DEPENDENCIES);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Save new values
|
//Save new values
|
||||||
|
|
|
||||||
|
|
@ -547,28 +547,32 @@ describe("Actions", () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const context = state;
|
const context = state;
|
||||||
const commit = jest.fn();
|
const commit = jest.fn();
|
||||||
|
const dispatch = jest.fn();
|
||||||
|
|
||||||
context.commit = commit;
|
context.commit = commit;
|
||||||
|
context.dispatch = dispatch;
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
await actions.resetDamageAndDependencies(context);
|
await actions.resetDamageAndDependencies(context);
|
||||||
|
|
||||||
expect(commit).toBeCalledWith(storeMutations.RESET_DAMAGE_STATE);
|
expect(commit).toBeCalledWith(storeMutations.RESET_DAMAGE_STATE);
|
||||||
expect(commit).toBeCalledWith(storeMutations.RESET_GLASS_PARTS_STATE);
|
expect(dispatch).toBeCalledWith(storeActions.RESET_PARTS_STATE_AND_DEPENDENCIES);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("resetRegistrationAndDependencies action", async () => {
|
it("resetRegistrationAndDependencies action", async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const context = state;
|
const context = state;
|
||||||
const commit = jest.fn();
|
const commit = jest.fn();
|
||||||
|
const dispatch = jest.fn();
|
||||||
|
|
||||||
context.commit = commit;
|
context.commit = commit;
|
||||||
|
context.dispatch = dispatch;
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
await actions.resetRegistrationAndDependencies(context);
|
await actions.resetRegistrationAndDependencies(context);
|
||||||
|
|
||||||
expect(commit).toBeCalledWith(storeMutations.RESET_REGISTRATION_STATE);
|
expect(commit).toBeCalledWith(storeMutations.RESET_REGISTRATION_STATE);
|
||||||
expect(commit).toBeCalledWith(storeMutations.RESET_GLASS_PARTS_STATE);
|
expect(dispatch).toBeCalledWith(storeActions.RESET_PARTS_STATE_AND_DEPENDENCIES);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("resetPartsAndDependencies action", async () => {
|
it("resetPartsAndDependencies action", async () => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue