Fixing unit tests
This commit is contained in:
parent
842a444e5c
commit
47380eda80
2 changed files with 22 additions and 20 deletions
|
|
@ -8,7 +8,7 @@ export function getDamageString() {
|
||||||
if(damageLocations.length > 1){
|
if(damageLocations.length > 1){
|
||||||
returnString = "match"
|
returnString = "match"
|
||||||
} else {
|
} else {
|
||||||
switch(damageLocations[0].location) {
|
switch(damageLocations[0]?.location) {
|
||||||
case "Windshield":
|
case "Windshield":
|
||||||
returnString = "windshield"
|
returnString = "windshield"
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -151,6 +151,9 @@ describe("license-plate-lookup.vue", () => {
|
||||||
wrapper.vm.validateZip = jest.fn().mockImplementation(() => {
|
wrapper.vm.validateZip = jest.fn().mockImplementation(() => {
|
||||||
return {data: {isServiceable: true}};
|
return {data: {isServiceable: true}};
|
||||||
});
|
});
|
||||||
|
wrapper.vm.getCmsContent = jest.fn().mockImplementation(() => {
|
||||||
|
return '';
|
||||||
|
});
|
||||||
const vinLookup = {data: {vehicle: {carId: "TESTID"}}}
|
const vinLookup = {data: {vehicle: {carId: "TESTID"}}}
|
||||||
wrapper.vm.lookupVin = jest.fn().mockImplementation(() => {
|
wrapper.vm.lookupVin = jest.fn().mockImplementation(() => {
|
||||||
return {catch: () => vinLookup};
|
return {catch: () => vinLookup};
|
||||||
|
|
@ -182,6 +185,9 @@ describe("license-plate-lookup.vue", () => {
|
||||||
wrapper.vm.validateZip = jest.fn().mockImplementation(() => {
|
wrapper.vm.validateZip = jest.fn().mockImplementation(() => {
|
||||||
return {data: {isServiceable: false}};
|
return {data: {isServiceable: false}};
|
||||||
});
|
});
|
||||||
|
wrapper.vm.getCmsContent = jest.fn().mockImplementation(() => {
|
||||||
|
return '';
|
||||||
|
});
|
||||||
wrapper.vm.$refs.funnelFooter.removeLoader = jest.fn();
|
wrapper.vm.$refs.funnelFooter.removeLoader = jest.fn();
|
||||||
//Act
|
//Act
|
||||||
licensePlateLookup.beforeRouteEnter.call(
|
licensePlateLookup.beforeRouteEnter.call(
|
||||||
|
|
@ -207,6 +213,9 @@ describe("license-plate-lookup.vue", () => {
|
||||||
wrapper.vm.validateZip = jest.fn().mockImplementation(() => {
|
wrapper.vm.validateZip = jest.fn().mockImplementation(() => {
|
||||||
return {data: {isServiceable: true}};
|
return {data: {isServiceable: true}};
|
||||||
});
|
});
|
||||||
|
wrapper.vm.getCmsContent = jest.fn().mockImplementation(() => {
|
||||||
|
return '';
|
||||||
|
});
|
||||||
const vinLookup = {data: {vehicle: {carId: "TESTID1"}}}
|
const vinLookup = {data: {vehicle: {carId: "TESTID1"}}}
|
||||||
wrapper.vm.lookupVin = jest.fn().mockImplementation(() => {
|
wrapper.vm.lookupVin = jest.fn().mockImplementation(() => {
|
||||||
return {catch: () => vinLookup};
|
return {catch: () => vinLookup};
|
||||||
|
|
@ -238,6 +247,9 @@ describe("license-plate-lookup.vue", () => {
|
||||||
wrapper.vm.validateZip = jest.fn().mockImplementation(() => {
|
wrapper.vm.validateZip = jest.fn().mockImplementation(() => {
|
||||||
return {data: {isServiceable: true}};
|
return {data: {isServiceable: true}};
|
||||||
});
|
});
|
||||||
|
wrapper.vm.getCmsContent = jest.fn().mockImplementation(() => {
|
||||||
|
return '';
|
||||||
|
});
|
||||||
const vinLookup = {data: {vehicle: {carId: "TESTID1"}}}
|
const vinLookup = {data: {vehicle: {carId: "TESTID1"}}}
|
||||||
wrapper.vm.lookupVin = jest.fn().mockImplementation(() => {
|
wrapper.vm.lookupVin = jest.fn().mockImplementation(() => {
|
||||||
return {catch: () => vinLookup};
|
return {catch: () => vinLookup};
|
||||||
|
|
@ -321,15 +333,12 @@ describe("license-plate-lookup.vue", () => {
|
||||||
//Act
|
//Act
|
||||||
wrapper.vm.isCarIdDifferent = true;
|
wrapper.vm.isCarIdDifferent = true;
|
||||||
wrapper.vm.isSelectedGlassAvailableForVehicle = false;
|
wrapper.vm.isSelectedGlassAvailableForVehicle = false;
|
||||||
|
wrapper.vm.getCmsContent = jest.fn().mockImplementation(() => {
|
||||||
|
return '';
|
||||||
|
});
|
||||||
store.commit = jest.fn();
|
store.commit = jest.fn();
|
||||||
store.dispatch = jest.fn();
|
store.dispatch = jest.fn();
|
||||||
|
|
||||||
licensePlateLookup.beforeRouteEnter.call(
|
|
||||||
wrapper.vm,
|
|
||||||
{ query: { fmgPage: "license-plate-lookup" } },
|
|
||||||
undefined,
|
|
||||||
(c) => c(wrapper.vm)
|
|
||||||
);
|
|
||||||
const vehicleInfo = {year: "2020", make: "honda", model: "civic", style: "2 door", carId: "TestId", category: "testCat", imageUrl: "image.jpg", imageVifNumber: "123", imageColor: "blue"}
|
const vehicleInfo = {year: "2020", make: "honda", model: "civic", style: "2 door", carId: "TestId", category: "testCat", imageUrl: "image.jpg", imageVifNumber: "123", imageColor: "blue"}
|
||||||
await wrapper.vm.updateCustomerInfo('vin', vehicleInfo, 'registrationState');
|
await wrapper.vm.updateCustomerInfo('vin', vehicleInfo, 'registrationState');
|
||||||
|
|
||||||
|
|
@ -348,14 +357,11 @@ describe("license-plate-lookup.vue", () => {
|
||||||
wrapper.vm.isCarIdDifferent = true;
|
wrapper.vm.isCarIdDifferent = true;
|
||||||
wrapper.vm.isSelectedGlassAvailableForVehicle = false;
|
wrapper.vm.isSelectedGlassAvailableForVehicle = false;
|
||||||
wrapper.vm.$router.navigateAfterSave = jest.fn();
|
wrapper.vm.$router.navigateAfterSave = jest.fn();
|
||||||
|
wrapper.vm.getCmsContent = jest.fn().mockImplementation(() => {
|
||||||
|
return '';
|
||||||
|
});
|
||||||
store.dispatch = jest.fn();
|
store.dispatch = jest.fn();
|
||||||
|
|
||||||
licensePlateLookup.beforeRouteEnter.call(
|
|
||||||
wrapper.vm,
|
|
||||||
{ query: { fmgPage: "license-plate-lookup" } },
|
|
||||||
undefined,
|
|
||||||
(c) => c(wrapper.vm)
|
|
||||||
);
|
|
||||||
await wrapper.vm.navigateForward();
|
await wrapper.vm.navigateForward();
|
||||||
|
|
||||||
//Assert
|
//Assert
|
||||||
|
|
@ -372,16 +378,12 @@ describe("license-plate-lookup.vue", () => {
|
||||||
//Act
|
//Act
|
||||||
wrapper.vm.isCarIdDifferent = false;
|
wrapper.vm.isCarIdDifferent = false;
|
||||||
wrapper.vm.$router.navigateAfterSaveToHeritageFunnel = jest.fn();
|
wrapper.vm.$router.navigateAfterSaveToHeritageFunnel = jest.fn();
|
||||||
|
wrapper.vm.getCmsContent = jest.fn().mockImplementation(() => {
|
||||||
|
return '';
|
||||||
|
});
|
||||||
|
|
||||||
licensePlateLookup.beforeRouteEnter.call(
|
|
||||||
wrapper.vm,
|
|
||||||
{ query: { fmgPage: "license-plate-lookup" } },
|
|
||||||
undefined,
|
|
||||||
(c) => c(wrapper.vm)
|
|
||||||
);
|
|
||||||
await wrapper.vm.navigateForward();
|
await wrapper.vm.navigateForward();
|
||||||
|
|
||||||
|
|
||||||
//Assert
|
//Assert
|
||||||
expect(wrapper.vm.$router.navigateAfterSaveToHeritageFunnel).toHaveBeenCalled();
|
expect(wrapper.vm.$router.navigateAfterSaveToHeritageFunnel).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue