diff --git a/src/layouts/service-location/shop-question/shop-question.spec.js b/src/layouts/service-location/shop-question/shop-question.spec.js index 70a158f0a..3c7bfa9dd 100644 --- a/src/layouts/service-location/shop-question/shop-question.spec.js +++ b/src/layouts/service-location/shop-question/shop-question.spec.js @@ -434,7 +434,7 @@ describe("shop-question.vue", () => { const { wrapper } = setupMocks({ mixins: [mockMixin], props: { - modelValue: selectedProvider.providerNumber, + modelValue: selectedProvider, serviceZipCode: "43081", selectedAppointmentType: "Dropoff", cmsWidgetName: cmsWidgetName, @@ -460,18 +460,7 @@ describe("shop-question.vue", () => { const { wrapper } = setupMocks({ mixins: [mockMixin], props: { - modelValue: { - address: { - city: "POWELL", - country: "US", - state: "OH", - streetAddress: "3938 POWELL RD", - zipCode: "43065", - }, - distanceInMiles: 16.2690495685233, - providerNumber: "003341", - }, - serviceZipCode: "43081", + modelValue: null, selectedAppointmentType: "Dropoff", cmsWidgetName: cmsWidgetName, }, @@ -481,21 +470,24 @@ describe("shop-question.vue", () => { }); // Act - wrapper.vm.initializeComponent(shopQuestionInitialData); + await wrapper.vm.initializeComponent(shopQuestionInitialData); await wrapper.vm.$nextTick(); + expect(wrapper.vm.answers.length).toEqual(3); + await wrapper.setProps({ selectedAppointmentType: "Inshop", }); + await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick(); // Assert expect(wrapper.vm.answers.length).toEqual(3); }); - // it("Should reload the shops when the service zip code changes", async () => { + // it.only("Should reload the shops when the service zip code changes", async () => { // // Arrange // const { wrapper } = setupMocks({ // mixins: [mockMixin], @@ -514,7 +506,7 @@ describe("shop-question.vue", () => { // serviceZipCode: "43081", // selectedAppointmentType: "Dropoff", // cmsWidgetName: cmsWidgetName, - // isDisplayed: true + // isDisplayed: true, // }, // mountOptions: { // attachTo: document.body, @@ -530,7 +522,7 @@ describe("shop-question.vue", () => { // // Act // wrapper.vm.initializeComponent(shopQuestionInitialData); - // await wrapper.vm.$options.watch.serviceZipCode.handler.call(wrapper.vm, "43054"); + // //await wrapper.vm.$options.watch.serviceZipCode.handler.call(wrapper.vm, "43054"); // // Assert // expect(wrapper.vm.shopProviders.length).toEqual(3); diff --git a/src/layouts/service-location/shop-question/shop-question.vue b/src/layouts/service-location/shop-question/shop-question.vue index db1c554de..f9be3976b 100644 --- a/src/layouts/service-location/shop-question/shop-question.vue +++ b/src/layouts/service-location/shop-question/shop-question.vue @@ -216,13 +216,14 @@ export default { if (this.selectedAppointmentType) { const selectedShopIndex = this.getSelectedProviderIndex( newValue, - this.modelValue.providerNumber + this.modelValue?.providerNumber ); if (selectedShopIndex >= 3) { await this.getNextShopsFromList(selectedShopIndex + 1); } else { await this.getNextShopsFromList(); + await this.$nextTick(); } } },