From 635d79c357ae7b37b512fe1a2c344679923caacb Mon Sep 17 00:00:00 2001 From: Chloe Herd Date: Wed, 14 Jun 2023 13:57:56 -0400 Subject: [PATCH 1/9] Implement first round of resetting logic per ticket --- src/store/index.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/store/index.js b/src/store/index.js index bd8ccffe7..ec015d9a6 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -1779,6 +1779,8 @@ export const actions = { if (!deepEqual(supportingItems, context.state.order.lineItems.supportingItems)) { context.commit(storeMutations.RESET_SERVICE_LOCATION_APPOINTMENT_TYPE); context.commit(storeMutations.RESET_SERVICE_LOCATION_PROVIDER); + + context.commit(storeMutations.RESET_SCHEDULE); } context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, supportingItems); @@ -1857,12 +1859,36 @@ export const actions = { context.commit(storeMutations.RESET_SERVICE_LOCATION_APPOINTMENT_TYPE); context.commit(storeMutations.RESET_SERVICE_LOCATION_PROVIDER); context.commit(storeMutations.RESET_SERVICE_LOCATION_MOBILE_ADDRESS); + + context.commit(storeMutations.RESET_SCHEDULE); } context.commit(storeMutations.UPDATE_SERVICE_LOCATION, serviceZipCodeInfo); }, saveServiceLocation(context, serviceLocationInfo) { + if (context.state.order.serviceLocationInfo) { + if (serviceLocationInfo.zipCode !== context.state.order.serviceLocationInfo.zipCode) { + context.commit(storeMutations.RESET_SCHEDULE); + } + + if ( + !deepEqual( + serviceLocationInfo.provider, + context.state.order.serviceLocationInfo.provider + ) + ) { + context.commit(storeMutations.RESET_SCHEDULE); + } + + if ( + serviceLocationInfo.appointmentType !== + context.state.order.serviceLocationInfo.appointmentType + ) { + context.commit(storeMutations.RESET_SCHEDULE); + } + } + context.commit(storeMutations.UPDATE_SERVICE_LOCATION, serviceLocationInfo); }, @@ -1887,6 +1913,8 @@ export const actions = { if (!deepEqual(parts, context.state.order.lineItems.glassParts)) { context.commit(storeMutations.RESET_SERVICE_LOCATION_APPOINTMENT_TYPE); context.commit(storeMutations.RESET_SERVICE_LOCATION_PROVIDER); + + context.commit(storeMutations.RESET_SCHEDULE); } context.commit(storeMutations.UPDATE_GLASS_PARTS, parts); From c27b3d612c54f21f83a0faab38144e1f6c63ad1c Mon Sep 17 00:00:00 2001 From: Chloe Herd Date: Wed, 14 Jun 2023 14:06:17 -0400 Subject: [PATCH 2/9] Catch missed path for resetting when zip changes --- src/store/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/store/index.js b/src/store/index.js index ec015d9a6..1ec9a264d 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -1869,6 +1869,10 @@ export const actions = { saveServiceLocation(context, serviceLocationInfo) { if (context.state.order.serviceLocationInfo) { if (serviceLocationInfo.zipCode !== context.state.order.serviceLocationInfo.zipCode) { + context.commit(storeMutations.RESET_SERVICE_LOCATION_APPOINTMENT_TYPE); + context.commit(storeMutations.RESET_SERVICE_LOCATION_PROVIDER); + context.commit(storeMutations.RESET_SERVICE_LOCATION_MOBILE_ADDRESS); + context.commit(storeMutations.RESET_SCHEDULE); } From c92ff4d1b518bba4a2b84178ecb9c01049931c06 Mon Sep 17 00:00:00 2001 From: Chloe Herd Date: Wed, 14 Jun 2023 14:06:17 -0400 Subject: [PATCH 3/9] Revert "Catch missed path for resetting when zip changes" This reverts commit c27b3d612c54f21f83a0faab38144e1f6c63ad1c. --- src/store/index.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/store/index.js b/src/store/index.js index 1ec9a264d..ec015d9a6 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -1869,10 +1869,6 @@ export const actions = { saveServiceLocation(context, serviceLocationInfo) { if (context.state.order.serviceLocationInfo) { if (serviceLocationInfo.zipCode !== context.state.order.serviceLocationInfo.zipCode) { - context.commit(storeMutations.RESET_SERVICE_LOCATION_APPOINTMENT_TYPE); - context.commit(storeMutations.RESET_SERVICE_LOCATION_PROVIDER); - context.commit(storeMutations.RESET_SERVICE_LOCATION_MOBILE_ADDRESS); - context.commit(storeMutations.RESET_SCHEDULE); } From 8348781ca7e109431292de0b6490ce0169f0319b Mon Sep 17 00:00:00 2001 From: Chloe Herd Date: Thu, 15 Jun 2023 14:55:06 -0400 Subject: [PATCH 4/9] Consolidated if statements --- src/store/index.js | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/src/store/index.js b/src/store/index.js index ec015d9a6..99a28e212 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -1868,22 +1868,14 @@ export const actions = { saveServiceLocation(context, serviceLocationInfo) { if (context.state.order.serviceLocationInfo) { - if (serviceLocationInfo.zipCode !== context.state.order.serviceLocationInfo.zipCode) { - context.commit(storeMutations.RESET_SCHEDULE); - } - if ( + serviceLocationInfo.zipCode !== context.state.order.serviceLocationInfo.zipCode || !deepEqual( serviceLocationInfo.provider, context.state.order.serviceLocationInfo.provider - ) - ) { - context.commit(storeMutations.RESET_SCHEDULE); - } - - if ( + ) || serviceLocationInfo.appointmentType !== - context.state.order.serviceLocationInfo.appointmentType + context.state.order.serviceLocationInfo.appointmentType ) { context.commit(storeMutations.RESET_SCHEDULE); } From 9b75367894a99da601a44ce2fa85d61a231ab5fa Mon Sep 17 00:00:00 2001 From: Chloe Herd Date: Tue, 20 Jun 2023 15:09:00 -0400 Subject: [PATCH 5/9] Update with better cascading logic. --- src/constants/store-actions.js | 1 + src/store/index.js | 35 +++++++++++++++++----------------- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/src/constants/store-actions.js b/src/constants/store-actions.js index ebffdebde..392e7b59e 100644 --- a/src/constants/store-actions.js +++ b/src/constants/store-actions.js @@ -54,6 +54,7 @@ const storeActions = { RESET_DAMAGE_STATE_AND_DEPENDENCIES: "resetDamageAndDependencies", RESET_REGISTRATION_STATE_AND_DEPENDENCIES: "resetRegistrationAndDependencies", RESET_PARTS_STATE_AND_DEPENDENCIES: "resetPartsAndDependencies", + RESET_SERVICE_LOCATION_STATE_AND_DEPENDENCIES: "resetServiceLocationAndDependencies", RESET_STATE: "resetState", // SAVE COMPONENT STATE diff --git a/src/store/index.js b/src/store/index.js index 99a28e212..7ad5c4457 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -343,7 +343,7 @@ export const mutations = { //early bird fee used on schedule page also needs reset when schedule is reset const supportingItems = state.order.lineItems.supportingItems; - const removeEarlyBirdIndex = supportingItems.findIndex( + const removeEarlyBirdIndex = supportingItems?.findIndex( (item) => item.partType == PREMIUM_FEE_PART_TYPE ); @@ -726,6 +726,15 @@ export const actions = { resetPartsAndDependencies(context) { context.commit(storeMutations.RESET_GLASS_PARTS_STATE); context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, null); + + context.dispatch(storeActions.RESET_SERVICE_LOCATION_STATE_AND_DEPENDENCIES); + }, + + resetServiceLocationAndDependencies(context) { + context.commit(storeMutations.RESET_SERVICE_LOCATION_APPOINTMENT_TYPE); + context.commit(storeMutations.RESET_SERVICE_LOCATION_PROVIDER); + + context.commit(storeMutations.RESET_SCHEDULE); }, resetState(context) { @@ -1777,10 +1786,7 @@ export const actions = { saveSupportingItems(context, supportingItems) { if (!deepEqual(supportingItems, context.state.order.lineItems.supportingItems)) { - context.commit(storeMutations.RESET_SERVICE_LOCATION_APPOINTMENT_TYPE); - context.commit(storeMutations.RESET_SERVICE_LOCATION_PROVIDER); - - context.commit(storeMutations.RESET_SCHEDULE); + context.dispatch(storeActions.RESET_SERVICE_LOCATION_STATE_AND_DEPENDENCIES); } context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, supportingItems); @@ -1856,26 +1862,24 @@ export const actions = { context.state.order.serviceLocation && serviceZipCodeInfo.zipCode !== context.state.order.serviceLocation.zipCode ) { - context.commit(storeMutations.RESET_SERVICE_LOCATION_APPOINTMENT_TYPE); - context.commit(storeMutations.RESET_SERVICE_LOCATION_PROVIDER); - context.commit(storeMutations.RESET_SERVICE_LOCATION_MOBILE_ADDRESS); + context.dispatch(storeActions.RESET_SERVICE_LOCATION_STATE_AND_DEPENDENCIES); - context.commit(storeMutations.RESET_SCHEDULE); + context.commit(storeMutations.RESET_SERVICE_LOCATION_MOBILE_ADDRESS); } context.commit(storeMutations.UPDATE_SERVICE_LOCATION, serviceZipCodeInfo); }, saveServiceLocation(context, serviceLocationInfo) { - if (context.state.order.serviceLocationInfo) { + if (context.state.order.serviceLocation) { if ( - serviceLocationInfo.zipCode !== context.state.order.serviceLocationInfo.zipCode || + serviceLocationInfo.zipCode !== context.state.order.serviceLocation.zipCode || !deepEqual( serviceLocationInfo.provider, - context.state.order.serviceLocationInfo.provider + context.state.order.serviceLocation.provider ) || serviceLocationInfo.appointmentType !== - context.state.order.serviceLocationInfo.appointmentType + context.state.order.serviceLocation.appointmentType ) { context.commit(storeMutations.RESET_SCHEDULE); } @@ -1903,10 +1907,7 @@ export const actions = { saveGlassParts(context, parts) { if (!deepEqual(parts, context.state.order.lineItems.glassParts)) { - context.commit(storeMutations.RESET_SERVICE_LOCATION_APPOINTMENT_TYPE); - context.commit(storeMutations.RESET_SERVICE_LOCATION_PROVIDER); - - context.commit(storeMutations.RESET_SCHEDULE); + context.dispatch(storeActions.RESET_SERVICE_LOCATION_STATE_AND_DEPENDENCIES); } context.commit(storeMutations.UPDATE_GLASS_PARTS, parts); From 11fd5a5e67b79e83f122a8bf10b03a5a9654f67b Mon Sep 17 00:00:00 2001 From: Chloe Herd Date: Tue, 20 Jun 2023 15:25:07 -0400 Subject: [PATCH 6/9] Patch directly failing tests --- src/store/store.spec.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/store/store.spec.js b/src/store/store.spec.js index 262cb263a..334118c23 100644 --- a/src/store/store.spec.js +++ b/src/store/store.spec.js @@ -575,13 +575,16 @@ describe("Actions", () => { // Arrange const context = state; const commit = jest.fn(); + const dispatch = jest.fn(); context.commit = commit; + context.dispatch = dispatch; // Act await actions.resetPartsAndDependencies(context); expect(commit).toBeCalledWith(storeMutations.RESET_GLASS_PARTS_STATE); + expect(dispatch).toBeCalledWith(storeActions.RESET_SERVICE_LOCATION_STATE_AND_DEPENDENCIES); }); it("resetState action", async () => { @@ -966,14 +969,17 @@ describe("Actions", () => { }; const commit = jest.fn(); + const dispatch = jest.fn(); context.commit = commit; + context.dispatch = dispatch; // Act actions.saveGlassParts(context, { glassParts: {} }); // Assert expect(commit).toBeCalledWith(storeMutations.UPDATE_GLASS_PARTS, { glassParts: {} }); + expect(dispatch).toBeCalledWith(storeActions.RESET_SERVICE_LOCATION_STATE_AND_DEPENDENCIES); }); it("clearVin, should call mutation", () => { From f30527c64fdab6373e3fd779d22027e746436463 Mon Sep 17 00:00:00 2001 From: Chloe Herd Date: Tue, 20 Jun 2023 15:48:37 -0400 Subject: [PATCH 7/9] Add tests for SaveSupportingItems --- src/store/store.spec.js | 75 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/src/store/store.spec.js b/src/store/store.spec.js index 334118c23..e35e463c6 100644 --- a/src/store/store.spec.js +++ b/src/store/store.spec.js @@ -982,6 +982,81 @@ describe("Actions", () => { expect(dispatch).toBeCalledWith(storeActions.RESET_SERVICE_LOCATION_STATE_AND_DEPENDENCIES); }); + it("saveSupportingItems, should call mutations", () => { + // Arrange + const context = { + state: state, + }; + + const commit = jest.fn(); + const dispatch = jest.fn(); + + context.commit = commit; + context.dispatch = dispatch; + + // Act + actions.saveSupportingItems(context, []); + + // Assert + expect(commit).toBeCalledWith(storeMutations.UPDATE_SUPPORTING_ITEMS, []); + }); + + it("saveSupportingItems, should call reset logic when value is new", () => { + // Arrange + const context = { + state: { + order: { + lineItems: { + supportingItems: [ + "TestValue1", + "TestValue2" + ], + }, + }, + }, + }; + + const commit = jest.fn(); + const dispatch = jest.fn(); + + context.commit = commit; + context.dispatch = dispatch; + + // Act + actions.saveSupportingItems(context, [ "TestValue3", "TestValue4", "TestValue5" ]); + + // Assert + expect(dispatch).toBeCalledWith(storeActions.RESET_SERVICE_LOCATION_STATE_AND_DEPENDENCIES); + }); + + it("saveSupportingItems, should not call reset logic when value is the same", () => { + // Arrange + const context = { + state: { + order: { + lineItems: { + supportingItems: [ + "TestValue1", + "TestValue2" + ], + }, + }, + }, + }; + + const commit = jest.fn(); + const dispatch = jest.fn(); + + context.commit = commit; + context.dispatch = dispatch; + + // Act + actions.saveSupportingItems(context, [ "TestValue1", "TestValue2" ]); + + // Assert + expect(dispatch).not.toBeCalledWith(storeActions.RESET_SERVICE_LOCATION_STATE_AND_DEPENDENCIES); + }); + it("clearVin, should call mutation", () => { // Arrange const context = state; From 74af79a8f3e2cd26d09dada93e7bfa88efbce258 Mon Sep 17 00:00:00 2001 From: Chloe Herd Date: Tue, 20 Jun 2023 16:11:51 -0400 Subject: [PATCH 8/9] Add tests for serviceZipCodeInfo and serviceLocation save methods --- src/store/store.spec.js | 314 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 314 insertions(+) diff --git a/src/store/store.spec.js b/src/store/store.spec.js index e35e463c6..8bb15311a 100644 --- a/src/store/store.spec.js +++ b/src/store/store.spec.js @@ -936,6 +936,84 @@ describe("Actions", () => { ); }); + it("saveServiceZipCodeInfo, should call mutation and save zip code to state", () => { + // Arrange + const context = state; + const commit = jest.fn(); + context.commit = commit; + + const serviceZipCodeInfo = { + zipCode: "43212", + }; + + // Act + actions.saveServiceLocation(context, serviceZipCodeInfo); + + // Assert + expect(commit).toBeCalledWith(storeMutations.UPDATE_SERVICE_LOCATION, serviceZipCodeInfo); + expect(state.order.serviceLocation.zipCode).toEqual("43212"); + }); + + it("saveServiceZipCodeInfo, should reset if zip code is different", () => { + // Arrange + const context = { + state: { + order: { + serviceLocation: { + zipCode: "43212", + }, + }, + }, + }; + + const commit = jest.fn(); + const dispatch = jest.fn(); + + context.commit = commit; + context.dispatch = dispatch; + + const serviceZipCodeInfo = { + zipCode: "43202", + }; + + // Act + actions.saveServiceZipCodeInfo(context, serviceZipCodeInfo); + + // Assert + expect(dispatch).toHaveBeenCalledWith(storeActions.RESET_SERVICE_LOCATION_STATE_AND_DEPENDENCIES); + expect(commit).toHaveBeenCalledWith(storeMutations.RESET_SERVICE_LOCATION_MOBILE_ADDRESS); + }); + + it("saveServiceZipCodeInfo, should not reset if zip code is the same", () => { + // Arrange + const context = { + state: { + order: { + serviceLocation: { + zipCode: "43212", + }, + }, + }, + }; + + const commit = jest.fn(); + const dispatch = jest.fn(); + + context.commit = commit; + context.dispatch = dispatch; + + const serviceZipCodeInfo = { + zipCode: "43212", + }; + + // Act + actions.saveServiceZipCodeInfo(context, serviceZipCodeInfo); + + // Assert + expect(dispatch).not.toHaveBeenCalledWith(storeActions.RESET_SERVICE_LOCATION_STATE_AND_DEPENDENCIES); + expect(commit).not.toHaveBeenCalledWith(storeMutations.RESET_SERVICE_LOCATION_MOBILE_ADDRESS); + }); + it("saveServiceLocation, should call mutation and save service address to state", () => { // Arrange const context = state; @@ -962,6 +1040,242 @@ describe("Actions", () => { expect(state.order.serviceLocation.zipCodeCtu).toEqual("01820"); }); + it("saveServiceLocation, should reset if zipcode is different", () => { + // Arrange + const context = { + state: { + order: { + serviceLocation: { + address: "123 Test Lane", + city: "Columbus", + zipCode: "43212", + state: "OH", + zipCodeCtu: "01820", + appointmentType: "Mobile", + isVehicleProtected: true, + provider: { + providerNumber: "11111", + address: { + streetAddress: "123 Test Lane", + city: "Columbus", + state: "OH", + zip: "43212", + }, + }, + }, + }, + }, + }; + + const commit = jest.fn(); + const dispatch = jest.fn(); + + context.commit = commit; + context.dispatch = dispatch; + + const serviceLocation = { + address: "123 Test Lane", + city: "Columbus", + zipCode: "43202", + state: "OH", + zipCodeCtu: "01820", + appointmentType: "Mobile", + isVehicleProtected: true, + provider: { + providerNumber: "11111", + address: { + streetAddress: "123 Test Lane", + city: "Columbus", + state: "OH", + zip: "43212", + }, + }, + }; + + // Act + actions.saveServiceLocation(context, serviceLocation); + + // Assert + expect(commit).toHaveBeenCalledWith(storeMutations.RESET_SCHEDULE); + }); + + it("saveServiceLocation, should reset if provider is different", () => { + // Arrange + const context = { + state: { + order: { + serviceLocation: { + address: "123 Test Lane", + city: "Columbus", + zipCode: "43212", + state: "OH", + zipCodeCtu: "01820", + appointmentType: "Mobile", + isVehicleProtected: true, + provider: { + providerNumber: "11111", + address: { + streetAddress: "123 Test Lane", + city: "Columbus", + state: "OH", + zip: "43212", + }, + }, + }, + }, + }, + }; + + const commit = jest.fn(); + const dispatch = jest.fn(); + + context.commit = commit; + context.dispatch = dispatch; + + const serviceLocation = { + address: "123 Test Lane", + city: "Columbus", + zipCode: "43212", + state: "OH", + zipCodeCtu: "01820", + appointmentType: "Mobile", + isVehicleProtected: true, + provider: { + providerNumber: "22222", + address: { + streetAddress: "321 Test Lane", + city: "Columbus", + state: "OH", + zip: "43212", + }, + }, + }; + + // Act + actions.saveServiceLocation(context, serviceLocation); + + // Assert + expect(commit).toHaveBeenCalledWith(storeMutations.RESET_SCHEDULE); + }); + + it("saveServiceLocation, should reset if appointment type is different", () => { + // Arrange + const context = { + state: { + order: { + serviceLocation: { + address: "123 Test Lane", + city: "Columbus", + zipCode: "43212", + state: "OH", + zipCodeCtu: "01820", + appointmentType: "Mobile", + isVehicleProtected: true, + provider: { + providerNumber: "11111", + address: { + streetAddress: "123 Test Lane", + city: "Columbus", + state: "OH", + zip: "43212", + }, + }, + }, + }, + }, + }; + + const commit = jest.fn(); + const dispatch = jest.fn(); + + context.commit = commit; + context.dispatch = dispatch; + + const serviceLocation = { + address: "123 Test Lane", + city: "Columbus", + zipCode: "43212", + state: "OH", + zipCodeCtu: "01820", + appointmentType: "Inshop", + isVehicleProtected: true, + provider: { + providerNumber: "11111", + address: { + streetAddress: "123 Test Lane", + city: "Columbus", + state: "OH", + zip: "43212", + }, + }, + }; + + // Act + actions.saveServiceLocation(context, serviceLocation); + + // Assert + expect(commit).toHaveBeenCalledWith(storeMutations.RESET_SCHEDULE); + }); + + it("saveServiceLocation, should not reset if parameters are the same", () => { + // Arrange + const context = { + state: { + order: { + serviceLocation: { + address: "123 Test Lane", + city: "Columbus", + zipCode: "43212", + state: "OH", + zipCodeCtu: "01820", + appointmentType: "Mobile", + isVehicleProtected: true, + provider: { + providerNumber: "11111", + address: { + streetAddress: "123 Test Lane", + city: "Columbus", + state: "OH", + zip: "43212", + }, + }, + }, + }, + }, + }; + + const commit = jest.fn(); + const dispatch = jest.fn(); + + context.commit = commit; + context.dispatch = dispatch; + + const serviceLocation = { + address: "123 Test Lane", + city: "Columbus", + zipCode: "43212", + state: "OH", + zipCodeCtu: "01820", + appointmentType: "Mobile", + isVehicleProtected: true, + provider: { + providerNumber: "11111", + address: { + streetAddress: "123 Test Lane", + city: "Columbus", + state: "OH", + zip: "43212", + }, + }, + }; + + // Act + actions.saveServiceLocation(context, serviceLocation); + + // Assert + expect(commit).not.toHaveBeenCalledWith(storeMutations.RESET_SCHEDULE); + }); + it("saveGlassParts, should call mutation", () => { // Arrange const context = { From 98d8d68aee5f3fefa98ed3ad8cd6f534508de9a3 Mon Sep 17 00:00:00 2001 From: Chloe Herd Date: Tue, 20 Jun 2023 16:22:38 -0400 Subject: [PATCH 9/9] Formatting --- src/store/store.spec.js | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/src/store/store.spec.js b/src/store/store.spec.js index 8bb15311a..847701e67 100644 --- a/src/store/store.spec.js +++ b/src/store/store.spec.js @@ -980,7 +980,9 @@ describe("Actions", () => { actions.saveServiceZipCodeInfo(context, serviceZipCodeInfo); // Assert - expect(dispatch).toHaveBeenCalledWith(storeActions.RESET_SERVICE_LOCATION_STATE_AND_DEPENDENCIES); + expect(dispatch).toHaveBeenCalledWith( + storeActions.RESET_SERVICE_LOCATION_STATE_AND_DEPENDENCIES + ); expect(commit).toHaveBeenCalledWith(storeMutations.RESET_SERVICE_LOCATION_MOBILE_ADDRESS); }); @@ -1010,8 +1012,12 @@ describe("Actions", () => { actions.saveServiceZipCodeInfo(context, serviceZipCodeInfo); // Assert - expect(dispatch).not.toHaveBeenCalledWith(storeActions.RESET_SERVICE_LOCATION_STATE_AND_DEPENDENCIES); - expect(commit).not.toHaveBeenCalledWith(storeMutations.RESET_SERVICE_LOCATION_MOBILE_ADDRESS); + expect(dispatch).not.toHaveBeenCalledWith( + storeActions.RESET_SERVICE_LOCATION_STATE_AND_DEPENDENCIES + ); + expect(commit).not.toHaveBeenCalledWith( + storeMutations.RESET_SERVICE_LOCATION_MOBILE_ADDRESS + ); }); it("saveServiceLocation, should call mutation and save service address to state", () => { @@ -1321,10 +1327,7 @@ describe("Actions", () => { state: { order: { lineItems: { - supportingItems: [ - "TestValue1", - "TestValue2" - ], + supportingItems: ["TestValue1", "TestValue2"], }, }, }, @@ -1337,7 +1340,7 @@ describe("Actions", () => { context.dispatch = dispatch; // Act - actions.saveSupportingItems(context, [ "TestValue3", "TestValue4", "TestValue5" ]); + actions.saveSupportingItems(context, ["TestValue3", "TestValue4", "TestValue5"]); // Assert expect(dispatch).toBeCalledWith(storeActions.RESET_SERVICE_LOCATION_STATE_AND_DEPENDENCIES); @@ -1349,10 +1352,7 @@ describe("Actions", () => { state: { order: { lineItems: { - supportingItems: [ - "TestValue1", - "TestValue2" - ], + supportingItems: ["TestValue1", "TestValue2"], }, }, }, @@ -1365,10 +1365,12 @@ describe("Actions", () => { context.dispatch = dispatch; // Act - actions.saveSupportingItems(context, [ "TestValue1", "TestValue2" ]); + actions.saveSupportingItems(context, ["TestValue1", "TestValue2"]); // Assert - expect(dispatch).not.toBeCalledWith(storeActions.RESET_SERVICE_LOCATION_STATE_AND_DEPENDENCIES); + expect(dispatch).not.toBeCalledWith( + storeActions.RESET_SERVICE_LOCATION_STATE_AND_DEPENDENCIES + ); }); it("clearVin, should call mutation", () => {