Merge pull request #400 from Safelite/lpl-test

Lpl test
This commit is contained in:
max-dempsey 2022-05-06 16:54:34 -04:00 committed by GitHub
commit 2b749d7abc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 7 deletions

View file

@ -3,6 +3,7 @@ import licensePlateLookup from "@/layouts/license-plate-lookup/license-plate-loo
// Supporting Files // Supporting Files
import { settleAllPromises } from "@/helpers/layout-helper.js"; import { settleAllPromises } from "@/helpers/layout-helper.js";
import * as navigateToHeritage from "@/helpers/heritage-integration/navigation-helper";
import baseMixin from "@/mixins/base-mixin"; import baseMixin from "@/mixins/base-mixin";
import { fetchCmsContentForPage } from "@/helpers/cms-content-helper"; import { fetchCmsContentForPage } from "@/helpers/cms-content-helper";
import { shallowMount, flushPromises } from "@vue/test-utils"; import { shallowMount, flushPromises } from "@vue/test-utils";
@ -380,16 +381,15 @@ describe("license-plate-lookup.vue", () => {
//Act //Act
wrapper.vm.isCarIdDifferent = false; wrapper.vm.isCarIdDifferent = false;
wrapper.vm.$router.navigateAfterSaveToHeritageFunnel = jest.fn();
wrapper.vm.$refs.loadingModal.showModal = jest.fn(); wrapper.vm.$refs.loadingModal.showModal = jest.fn();
wrapper.vm.getCmsContent = jest.fn().mockImplementation(() => { wrapper.vm.getCmsContent = jest.fn().mockImplementation(() => {
return ''; return '';
}); });
navigateToHeritage.navigateAfterSaveToHeritageFunnel = jest.fn();
await wrapper.vm.navigateForward(); await wrapper.vm.navigateForward();
//Assert //Assert
expect(wrapper.vm.$router.navigateAfterSaveToHeritageFunnel).toHaveBeenCalled(); expect(navigateToHeritage.navigateAfterSaveToHeritageFunnel).toHaveBeenCalled();
}); });
}); });

View file

@ -70,6 +70,9 @@ import {
import { import {
errorMessages errorMessages
} from "@/constants/error-messages"; } from "@/constants/error-messages";
import {
navigateAfterSaveToHeritageFunnel
} from "@/helpers/heritage-integration/navigation-helper";
import { import {
getDamageString, getDamageString,
isGlassAvailableForCarId, isGlassAvailableForCarId,
@ -134,6 +137,7 @@ export default {
previouslyEnteredCarId: "", previouslyEnteredCarId: "",
customAlertData: {}, customAlertData: {},
isSelectedGlassAvailableForVehicle: true, isSelectedGlassAvailableForVehicle: true,
zipToDisplay: this.getRegistrationZipFromStore(),
}; };
}, },
mounted() { mounted() {
@ -171,7 +175,7 @@ export default {
let text = this.getCmsContent( let text = this.getCmsContent(
"NoServiceZipWidget", "NoServiceZipWidget",
"HeadlineText" "HeadlineText"
).replaceAll("{custom:zip}", this.registrationZip); ).replaceAll("{custom:zip}", this.zipToDisplay);
return text; return text;
}, },
NoServiceZipBody() { NoServiceZipBody() {
@ -223,6 +227,7 @@ export default {
this.isVinValid = true; this.isVinValid = true;
this.isRegistrationZipServicable = false; this.isRegistrationZipServicable = false;
this.isCarIdDifferent = false; this.isCarIdDifferent = false;
this.zipToDisplay = this.serviceZip ? this.serviceZip : this.registrationZip;
return; return;
} }
const vinLookup = await this.lookupVin( const vinLookup = await this.lookupVin(
@ -273,7 +278,7 @@ export default {
return; return;
} else { } else {
this.$refs.loadingModal.showModal(); this.$refs.loadingModal.showModal();
this.$router.navigateAfterSaveToHeritageFunnel(this.$route); navigateAfterSaveToHeritageFunnel(this.$route);
return; return;
} }
}, },

View file

@ -144,7 +144,7 @@ export const mutations = {
updateRegistrationAddress(state, registrationAddress){ updateRegistrationAddress(state, registrationAddress){
state.order.vehicle.registration.address = registrationAddress; state.order.vehicle.registration.address = registrationAddress;
}, },
updateServiceLocationZip(state, serviceLocationZip){ updateServiceLocationZipCode(state, serviceLocationZip){
state.order.vehicle.registration.zip = serviceLocationZip; state.order.vehicle.registration.zip = serviceLocationZip;
}, },
updateRegistrationCity(state, serviceCity){ updateRegistrationCity(state, serviceCity){