Update unit test.
This commit is contained in:
parent
c61e83695a
commit
62550ab6a0
3 changed files with 28 additions and 40 deletions
|
|
@ -4,7 +4,9 @@ import vinInformation from "@/layouts/vin-lookup/vin-information/vin-information
|
||||||
describe("vinInformation.vue", () => {
|
describe("vinInformation.vue", () => {
|
||||||
it("Should return input class active if isActive is true", async () => {
|
it("Should return input class active if isActive is true", async () => {
|
||||||
// Act
|
// Act
|
||||||
const wrapper = shallowMount(vinInformation);
|
const wrapper = shallowMount(vinInformation, {
|
||||||
|
mixins: [mockMixin]
|
||||||
|
});
|
||||||
|
|
||||||
await wrapper.setData({
|
await wrapper.setData({
|
||||||
isActive: true,
|
isActive: true,
|
||||||
|
|
@ -16,3 +18,9 @@ describe("vinInformation.vue", () => {
|
||||||
expect(wrapper.vm.isActive).toEqual(false);
|
expect(wrapper.vm.isActive).toEqual(false);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const mockMixin = {
|
||||||
|
methods: {
|
||||||
|
getCmsContent: jest.fn()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,29 +18,9 @@
|
||||||
|
|
||||||
import textLink from "@/ux-components/text-link/text-link";
|
import textLink from "@/ux-components/text-link/text-link";
|
||||||
//Supporting files
|
//Supporting files
|
||||||
import { fetchCmsContentForPage } from "@/helpers/cms-content-helper";
|
|
||||||
import { settleAllPromises } from "@/helpers/layout-helper";
|
import { settleAllPromises } from "@/helpers/layout-helper";
|
||||||
export default {
|
export default {
|
||||||
name: "vinInformation",
|
name: "vinInformation",
|
||||||
async beforeRouteEnter(to, from, next) {
|
|
||||||
// Call APIs
|
|
||||||
const cmsContentPromise = fetchCmsContentForPage(to.query.fmgPage);
|
|
||||||
|
|
||||||
// Settle promises and get results
|
|
||||||
const promiseResultMap = [
|
|
||||||
{
|
|
||||||
resultKey: "cmsContent",
|
|
||||||
promise: cmsContentPromise,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
const resultMap = await settleAllPromises(promiseResultMap);
|
|
||||||
|
|
||||||
// Call the "next" function to complete the transition to this page.
|
|
||||||
next((vm) => {
|
|
||||||
vm.setCmsContent(resultMap.cmsContent);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
components: {
|
components: {
|
||||||
textLink,
|
textLink,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -56,19 +56,19 @@
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<alert ref="alertInvalidZip"
|
<alert ref="alertInvalidZip"
|
||||||
v-if="displayInvalidZipAlert"
|
v-if="displayInvalidZipAlert"
|
||||||
class="my-4"
|
class="my-4"
|
||||||
cmsWidgetName="AlertInvalidZipWidget"
|
cmsWidgetName="AlertInvalidZipWidget"
|
||||||
alertClass="alert-danger"
|
alertClass="alert-danger"
|
||||||
v-bind:isDismissible="false"
|
v-bind:isDismissible="false"
|
||||||
/>
|
/>
|
||||||
<alert
|
<alert
|
||||||
class="my-4"
|
class="my-4"
|
||||||
:manualHeadline="AlertPerfectMatchInsuranceVerifiedHeader"
|
:manualHeadline="AlertPerfectMatchInsuranceVerifiedHeader"
|
||||||
:manualCopy="AlertPerfectMatchInsuranceVerifiedBody"
|
:manualCopy="AlertPerfectMatchInsuranceVerifiedBody"
|
||||||
v-model="customAlertData"
|
v-model="customAlertData"
|
||||||
v-if="vinPopulatedOnPageLoad && isInsuranceVerified"
|
v-if="vinPopulatedOnPageLoad && isInsuranceVerified"
|
||||||
alertClass="alert-success"
|
alertClass="alert-success"
|
||||||
/>
|
/>
|
||||||
<alert
|
<alert
|
||||||
|
|
@ -173,7 +173,7 @@ export default {
|
||||||
return {
|
return {
|
||||||
vin: this.getVinFromStore(),
|
vin: this.getVinFromStore(),
|
||||||
serviceZipCode: this.getZipFromStore(),
|
serviceZipCode: this.getZipFromStore(),
|
||||||
emailAddress: this.getEmailFromStore(),
|
emailAddress: this.getEmailFromStore(),
|
||||||
isCarIdDifferent: false,
|
isCarIdDifferent: false,
|
||||||
customAlertData: {},
|
customAlertData: {},
|
||||||
previouslyEnteredCarId: '',
|
previouslyEnteredCarId: '',
|
||||||
|
|
@ -198,7 +198,7 @@ export default {
|
||||||
getZipFromStore(){
|
getZipFromStore(){
|
||||||
return this.$store.getters.order.serviceLocation.zipCode;
|
return this.$store.getters.order.serviceLocation.zipCode;
|
||||||
},
|
},
|
||||||
attachCustomEvents() {
|
attachCustomEvents() {
|
||||||
this.prependActionToMethod(this, this.forwardButtonAction, () => {
|
this.prependActionToMethod(this, this.forwardButtonAction, () => {
|
||||||
this.pushEventToGA(
|
this.pushEventToGA(
|
||||||
this.$route.query[this.queryStrings.FMG_PAGE],
|
this.$route.query[this.queryStrings.FMG_PAGE],
|
||||||
|
|
@ -243,9 +243,9 @@ export default {
|
||||||
if (this.serviceZipCode && !isZipValid) {
|
if (this.serviceZipCode && !isZipValid) {
|
||||||
this.displayInvalidZipAlert = true;
|
this.displayInvalidZipAlert = true;
|
||||||
return this.$refs.funnelFooter.removeLoader();
|
return this.$refs.funnelFooter.removeLoader();
|
||||||
}
|
}
|
||||||
this.displayInvalidZipAlert = false;
|
this.displayInvalidZipAlert = false;
|
||||||
|
|
||||||
// If either lookup fails, remove the loader and stop processing the page.
|
// If either lookup fails, remove the loader and stop processing the page.
|
||||||
if (!resultMap.vehicleLookupResponse || !resultMap.serviceZipValidationResponse.isServiceable) {
|
if (!resultMap.vehicleLookupResponse || !resultMap.serviceZipValidationResponse.isServiceable) {
|
||||||
// If the vehicle result is undefined, the vin entered was invalid.
|
// If the vehicle result is undefined, the vin entered was invalid.
|
||||||
|
|
@ -270,7 +270,7 @@ export default {
|
||||||
this.previouslyEnteredCarId = resultMap.vehicleLookupResponse.carId;
|
this.previouslyEnteredCarId = resultMap.vehicleLookupResponse.carId;
|
||||||
this.customAlertData.vehicleInfo = resultMap.vehicleLookupResponse;
|
this.customAlertData.vehicleInfo = resultMap.vehicleLookupResponse;
|
||||||
this.displayMatchedDifferentVehicleAlert = true;
|
this.displayMatchedDifferentVehicleAlert = true;
|
||||||
|
|
||||||
this.isSelectedGlassAvailableForVehicle = await isGlassAvailableForCarId(resultMap.vehicleLookupResponse.carId);
|
this.isSelectedGlassAvailableForVehicle = await isGlassAvailableForCarId(resultMap.vehicleLookupResponse.carId);
|
||||||
|
|
||||||
// Update button "Continue with..."
|
// Update button "Continue with..."
|
||||||
|
|
@ -292,12 +292,12 @@ export default {
|
||||||
}, false);
|
}, false);
|
||||||
|
|
||||||
return await this.navigateForward();
|
return await this.navigateForward();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If a VIN has already been found. Validate the Service Zip (in case of changes)
|
// If a VIN has already been found. Validate the Service Zip (in case of changes)
|
||||||
const zipValidationResponse = await this.dispatchStoreAction(storeActions.VALIDATE_ZIP, {zip: this.serviceZipCode});
|
const zipValidationResponse = await this.dispatchStoreAction(storeActions.VALIDATE_ZIP, {zip: this.serviceZipCode});
|
||||||
|
|
||||||
// Check if Service Zip entered is serviceable
|
// Check if Service Zip entered is serviceable
|
||||||
if (zipValidationResponse.data.isServiceable) {
|
if (zipValidationResponse.data.isServiceable) {
|
||||||
// If the Service Zip entered is serviceable then save the Zip Info and Email Address and navigate forward
|
// If the Service Zip entered is serviceable then save the Zip Info and Email Address and navigate forward
|
||||||
|
|
@ -379,8 +379,8 @@ export default {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return 'XXXXXXXXXXXXXXXXX';
|
return 'XXXXXXXXXXXXXXXXX';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
vin() {
|
vin() {
|
||||||
|
|
@ -397,10 +397,10 @@ export default {
|
||||||
vehicleBanner,
|
vehicleBanner,
|
||||||
funnelSubHeader,
|
funnelSubHeader,
|
||||||
textboxQuestion,
|
textboxQuestion,
|
||||||
alert,
|
alert,
|
||||||
vinInformation,
|
vinInformation,
|
||||||
loadingModal,
|
loadingModal,
|
||||||
Form,
|
Form,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue