Formatting stuff
This commit is contained in:
parent
dcee556dc5
commit
f0fb7cfeaa
4 changed files with 82 additions and 61 deletions
|
|
@ -64,7 +64,7 @@ describe("license-plate-lookup.vue", () => {
|
||||||
test("getEmailFromStore returns store customer email", async () => {
|
test("getEmailFromStore returns store customer email", async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const mockEmail = "test12345@test.com";
|
const mockEmail = "test12345@test.com";
|
||||||
const { wrapper } = setupMocks({emailAddress: mockEmail});
|
const { wrapper } = setupMocks({ emailAddress: mockEmail });
|
||||||
|
|
||||||
// ACT
|
// ACT
|
||||||
const customerEmail = wrapper.vm.getEmailFromStore();
|
const customerEmail = wrapper.vm.getEmailFromStore();
|
||||||
|
|
@ -75,7 +75,7 @@ describe("license-plate-lookup.vue", () => {
|
||||||
|
|
||||||
test("getServiceZipFromStore returns store service zip", async () => {
|
test("getServiceZipFromStore returns store service zip", async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const { wrapper } = setupMocks({ serviceLocationZipCode: '98765' });
|
const { wrapper } = setupMocks({ serviceLocationZipCode: "98765" });
|
||||||
|
|
||||||
// ACT
|
// ACT
|
||||||
const serviceZip = wrapper.vm.getServiceZipFromStore();
|
const serviceZip = wrapper.vm.getServiceZipFromStore();
|
||||||
|
|
@ -110,7 +110,12 @@ describe("license-plate-lookup.vue", () => {
|
||||||
const mockCarId = "TESTID";
|
const mockCarId = "TESTID";
|
||||||
const { wrapper } = setupMocks({
|
const { wrapper } = setupMocks({
|
||||||
carId: mockCarId,
|
carId: mockCarId,
|
||||||
validateZipResponse: { isServiceable: true, isValid: true, zipCodeCtu: "01820", state: "OH" }
|
validateZipResponse: {
|
||||||
|
isServiceable: true,
|
||||||
|
isValid: true,
|
||||||
|
zipCodeCtu: "01820",
|
||||||
|
state: "OH",
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
wrapper.vm.getCmsContent = jest.fn().mockImplementation(() => "");
|
wrapper.vm.getCmsContent = jest.fn().mockImplementation(() => "");
|
||||||
|
|
@ -180,7 +185,12 @@ describe("license-plate-lookup.vue", () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const { wrapper } = setupMocks({
|
const { wrapper } = setupMocks({
|
||||||
carId: "C10000",
|
carId: "C10000",
|
||||||
validateZipResponse: { isServiceable: true, isValid: true, zipCodeCtu: "01820", state: "OH" }
|
validateZipResponse: {
|
||||||
|
isServiceable: true,
|
||||||
|
isValid: true,
|
||||||
|
zipCodeCtu: "01820",
|
||||||
|
state: "OH",
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
wrapper.vm.getCmsContent = jest.fn().mockImplementation(() => {
|
wrapper.vm.getCmsContent = jest.fn().mockImplementation(() => {
|
||||||
|
|
@ -346,9 +356,14 @@ describe("license-plate-lookup.vue", () => {
|
||||||
|
|
||||||
// Arrange
|
// Arrange
|
||||||
const { wrapper } = setupMocks({
|
const { wrapper } = setupMocks({
|
||||||
validateZipResponse: { isServiceable: true, isValid: true, zipCodeCtu: "01820", state: "OH" },
|
validateZipResponse: {
|
||||||
|
isServiceable: true,
|
||||||
|
isValid: true,
|
||||||
|
zipCodeCtu: "01820",
|
||||||
|
state: "OH",
|
||||||
|
},
|
||||||
serviceLocationZipCode: "12345",
|
serviceLocationZipCode: "12345",
|
||||||
registrationZipCode: "12345"
|
registrationZipCode: "12345",
|
||||||
});
|
});
|
||||||
|
|
||||||
wrapper.vm.getCmsContent = jest.fn().mockImplementation(() => "");
|
wrapper.vm.getCmsContent = jest.fn().mockImplementation(() => "");
|
||||||
|
|
@ -357,11 +372,11 @@ describe("license-plate-lookup.vue", () => {
|
||||||
navigateToHeritage.navigateToHeritageFunnel = jest.fn();
|
navigateToHeritage.navigateToHeritageFunnel = jest.fn();
|
||||||
|
|
||||||
wrapper.vm.lookupVinByPlate = jest.fn(() => {
|
wrapper.vm.lookupVinByPlate = jest.fn(() => {
|
||||||
return { data: { vehicle: { carId: "C00000", } } }
|
return { data: { vehicle: { carId: "C00000" } } };
|
||||||
});
|
});
|
||||||
|
|
||||||
storeMutations.lookupVinByPlate = jest.fn().mockImplementation(() => {
|
storeMutations.lookupVinByPlate = jest.fn().mockImplementation(() => {
|
||||||
return { data: { vehicle: { carId: "C00000", } } }
|
return { data: { vehicle: { carId: "C00000" } } };
|
||||||
});
|
});
|
||||||
|
|
||||||
wrapper.vm.dispatchStoreAction = jest.fn().mockImplementation(() =>
|
wrapper.vm.dispatchStoreAction = jest.fn().mockImplementation(() =>
|
||||||
|
|
@ -392,7 +407,7 @@ describe("license-plate-lookup.vue", () => {
|
||||||
const { wrapper } = setupMocks({
|
const { wrapper } = setupMocks({
|
||||||
validateZipResponse: { isServiceable: false, isValid: true },
|
validateZipResponse: { isServiceable: false, isValid: true },
|
||||||
serviceLocationZipCode: "12345",
|
serviceLocationZipCode: "12345",
|
||||||
registrationZipCode: "12345"
|
registrationZipCode: "12345",
|
||||||
});
|
});
|
||||||
// TODO FIX - test succeeds even if you comment this line out, is it doing anything?
|
// TODO FIX - test succeeds even if you comment this line out, is it doing anything?
|
||||||
wrapper.vm.validateZip = jest.fn().mockImplementation(() => {
|
wrapper.vm.validateZip = jest.fn().mockImplementation(() => {
|
||||||
|
|
@ -466,16 +481,16 @@ describe("license-plate-lookup.vue", () => {
|
||||||
test("registrationZip is not serviceable so serviceZip field is shown, user enters serviceZip => user can continue", async () => {
|
test("registrationZip is not serviceable so serviceZip field is shown, user enters serviceZip => user can continue", async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const { wrapper } = setupMocks({
|
const { wrapper } = setupMocks({
|
||||||
validateZipResponse: { isServiceable: false, isValid: true }
|
validateZipResponse: { isServiceable: false, isValid: true },
|
||||||
});
|
});
|
||||||
const registrationZip = "00000";
|
const registrationZip = "00000";
|
||||||
const serviceZip = "99999";
|
const serviceZip = "99999";
|
||||||
|
|
||||||
wrapper.vm.navigateForward = jest.fn();
|
wrapper.vm.navigateForward = jest.fn();
|
||||||
|
|
||||||
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 new Promise(resolve => resolve(vinLookup));
|
return new Promise((resolve) => resolve(vinLookup));
|
||||||
});
|
});
|
||||||
|
|
||||||
await wrapper.setData({ registrationZipCode: registrationZip });
|
await wrapper.setData({ registrationZipCode: registrationZip });
|
||||||
|
|
@ -513,9 +528,9 @@ describe("license-plate-lookup.vue", () => {
|
||||||
console.log("this is the test I care about");
|
console.log("this is the test I care about");
|
||||||
|
|
||||||
wrapper.vm.navigateForward = jest.fn();
|
wrapper.vm.navigateForward = jest.fn();
|
||||||
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 new Promise(resolve => resolve(vinLookup));
|
return new Promise((resolve) => resolve(vinLookup));
|
||||||
});
|
});
|
||||||
|
|
||||||
await wrapper.setData({ registrationZipCode: registrationZip });
|
await wrapper.setData({ registrationZipCode: registrationZip });
|
||||||
|
|
@ -608,7 +623,7 @@ function setupMocks({
|
||||||
serviceLocationZipCode = null,
|
serviceLocationZipCode = null,
|
||||||
registrationZipCode = null,
|
registrationZipCode = null,
|
||||||
licensePlate = null, //"TESTPLATE",
|
licensePlate = null, //"TESTPLATE",
|
||||||
emailAddress = null //"test@test.com"
|
emailAddress = null, //"test@test.com"
|
||||||
}) {
|
}) {
|
||||||
store.commit(storeMutations.RESET_STATE);
|
store.commit(storeMutations.RESET_STATE);
|
||||||
//Mock api responses
|
//Mock api responses
|
||||||
|
|
|
||||||
|
|
@ -225,12 +225,14 @@ export default {
|
||||||
const resultMap = await settleAllPromises(promiseResultMap);
|
const resultMap = await settleAllPromises(promiseResultMap);
|
||||||
|
|
||||||
// Lookup vin
|
// Lookup vin
|
||||||
const vinLookup = await this.lookupVin(this.licensePlate, resultMap.registrationZipValidationResponse.state)
|
const vinLookup = await this.lookupVin(
|
||||||
.catch(() => {
|
this.licensePlate,
|
||||||
// No VIN found.
|
resultMap.registrationZipValidationResponse.state
|
||||||
this.displayVinNotFoundAlert = true;
|
).catch(() => {
|
||||||
return this.$refs.funnelFooter.removeLoader();
|
// No VIN found.
|
||||||
});
|
this.displayVinNotFoundAlert = true;
|
||||||
|
return this.$refs.funnelFooter.removeLoader();
|
||||||
|
});
|
||||||
// If no VIN was found, stop processing after displaying alert
|
// If no VIN was found, stop processing after displaying alert
|
||||||
if (!vinLookup) {
|
if (!vinLookup) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -312,7 +314,11 @@ export default {
|
||||||
return await this.navigateForward();
|
return await this.navigateForward();
|
||||||
},
|
},
|
||||||
lookupVin(plate, state) {
|
lookupVin(plate, state) {
|
||||||
return this.dispatchStoreAction(storeActions.LOOKUP_VIN_BY_PLATE,{ licensePlate: plate, licenseState: state }, false);
|
return this.dispatchStoreAction(
|
||||||
|
storeActions.LOOKUP_VIN_BY_PLATE,
|
||||||
|
{ licensePlate: plate, licenseState: state },
|
||||||
|
false
|
||||||
|
);
|
||||||
},
|
},
|
||||||
async navigateForward() {
|
async navigateForward() {
|
||||||
if (this.isCarIdDifferent && !this.isSelectedGlassAvailableForVehicle) {
|
if (this.isCarIdDifferent && !this.isSelectedGlassAvailableForVehicle) {
|
||||||
|
|
|
||||||
|
|
@ -130,11 +130,11 @@ export default {
|
||||||
methods: {
|
methods: {
|
||||||
arePagePrerequisitesValid() {
|
arePagePrerequisitesValid() {
|
||||||
return (
|
return (
|
||||||
(store.getters.order.serviceLocation.zipCode && store.getters.order.serviceLocation.zipCodeCtu)
|
store.getters.order.serviceLocation.zipCode &&
|
||||||
&&
|
store.getters.order.serviceLocation.zipCodeCtu &&
|
||||||
(store.getters.order.damage.isRepair ||
|
(store.getters.order.damage.isRepair ||
|
||||||
(store.getters.order.lineItems?.glassParts != null &&
|
(store.getters.order.lineItems?.glassParts != null &&
|
||||||
store.getters.order.lineItems.glassParts.length > 0))
|
store.getters.order.lineItems.glassParts.length > 0))
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
getDefaultIsInsuranceSelectedValue() {
|
getDefaultIsInsuranceSelectedValue() {
|
||||||
|
|
|
||||||
|
|
@ -322,7 +322,7 @@ describe("Mutations", () => {
|
||||||
zipCode: "43212",
|
zipCode: "43212",
|
||||||
state: "OH",
|
state: "OH",
|
||||||
zipCodeCtu: "01820",
|
zipCodeCtu: "01820",
|
||||||
}
|
};
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
mutations.updateServiceLocation(storeState, serviceLocation);
|
mutations.updateServiceLocation(storeState, serviceLocation);
|
||||||
|
|
@ -491,11 +491,11 @@ describe("Actions", () => {
|
||||||
globalMethods.callHttpClient.mockImplementation(() => {
|
globalMethods.callHttpClient.mockImplementation(() => {
|
||||||
return Promise.resolve({
|
return Promise.resolve({
|
||||||
data: {
|
data: {
|
||||||
"isValid": true,
|
isValid: true,
|
||||||
"isServiceable": true,
|
isServiceable: true,
|
||||||
"state": "OH",
|
state: "OH",
|
||||||
"zipCodeCtu": "01820"
|
zipCodeCtu: "01820",
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -503,10 +503,10 @@ describe("Actions", () => {
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
expect(response.data).toEqual({
|
expect(response.data).toEqual({
|
||||||
"isValid": true,
|
isValid: true,
|
||||||
"isServiceable": true,
|
isServiceable: true,
|
||||||
"state": "OH",
|
state: "OH",
|
||||||
"zipCodeCtu": "01820"
|
zipCodeCtu: "01820",
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -912,7 +912,7 @@ describe("Actions", () => {
|
||||||
zipCode: "43212",
|
zipCode: "43212",
|
||||||
state: "OH",
|
state: "OH",
|
||||||
zipCodeCtu: "01820",
|
zipCodeCtu: "01820",
|
||||||
}
|
};
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
actions.saveServiceLocation(context, serviceLocation);
|
actions.saveServiceLocation(context, serviceLocation);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue