Merge remote-tracking branch 'origin/develop' into feature/CSR-944-dev
This commit is contained in:
commit
883bc34468
19 changed files with 244 additions and 133 deletions
|
|
@ -15,10 +15,6 @@
|
||||||
data-bs-target="#footerModal"
|
data-bs-target="#footerModal"
|
||||||
data-bs-dismiss="modal" />
|
data-bs-dismiss="modal" />
|
||||||
</div>
|
</div>
|
||||||
<!-- TODO KO DELETE FOR QUOTE MVP -->
|
|
||||||
<div class="col-auto">
|
|
||||||
<button @click="$emit('tempButtonClicked')">Heritage</button>
|
|
||||||
</div>
|
|
||||||
<div v-if="!isBackButtonHidden" class="col-auto link-col py-1 text-break">
|
<div v-if="!isBackButtonHidden" class="col-auto link-col py-1 text-break">
|
||||||
<textLink
|
<textLink
|
||||||
linkType="navigation"
|
linkType="navigation"
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ const applicationConfig = {
|
||||||
APPLICATION_NAME: "FixMyGlass",
|
APPLICATION_NAME: "FixMyGlass",
|
||||||
APPLICATION_ABBREVIATION: "fmg",
|
APPLICATION_ABBREVIATION: "fmg",
|
||||||
SITE_ENTRY_TRIGGER_VALUE: "FixMyGlass",
|
SITE_ENTRY_TRIGGER_VALUE: "FixMyGlass",
|
||||||
|
CASH_ACCOUNT_NUMBER: 167132,
|
||||||
};
|
};
|
||||||
|
|
||||||
export { applicationConfig };
|
export { applicationConfig };
|
||||||
|
|
|
||||||
|
|
@ -31,8 +31,6 @@ const storeMutations = {
|
||||||
UPDATE_REGISTRATION_LAST_NAME: "updateRegistrationLastName",
|
UPDATE_REGISTRATION_LAST_NAME: "updateRegistrationLastName",
|
||||||
UPDATE_REGISTRATION: "updateRegistration",
|
UPDATE_REGISTRATION: "updateRegistration",
|
||||||
|
|
||||||
UPDATE_SERVICE_LOCATION_ZIP_CODE: "updateServiceLocationZipCode",
|
|
||||||
UPDATE_SERVICE_LOCATION_STATE: "updateServiceLocationState",
|
|
||||||
UPDATE_SERVICE_LOCATION: "updateServiceLocation",
|
UPDATE_SERVICE_LOCATION: "updateServiceLocation",
|
||||||
|
|
||||||
UPDATE_CUSTOMER_EMAIL_ADDRESS: "updateCustomerEmailAddress",
|
UPDATE_CUSTOMER_EMAIL_ADDRESS: "updateCustomerEmailAddress",
|
||||||
|
|
|
||||||
|
|
@ -560,6 +560,7 @@ describe("address-lookup.vue", () => {
|
||||||
// Act
|
// Act
|
||||||
await wrapper.vm.forwardButtonAction();
|
await wrapper.vm.forwardButtonAction();
|
||||||
|
|
||||||
|
//FIX THIS
|
||||||
// Assert
|
// Assert
|
||||||
expect(wrapper.vm.dispatchStoreAction).not.toHaveBeenCalledWith(
|
expect(wrapper.vm.dispatchStoreAction).not.toHaveBeenCalledWith(
|
||||||
storeActions.UPDATE_SERVICE_LOCATION_WITH_VEHICLE_REGISTRATION
|
storeActions.UPDATE_SERVICE_LOCATION_WITH_VEHICLE_REGISTRATION
|
||||||
|
|
|
||||||
|
|
@ -344,6 +344,7 @@ export default {
|
||||||
city: this.customerQuestions.addressQuestions.city,
|
city: this.customerQuestions.addressQuestions.city,
|
||||||
zipCode: this.serviceZipCode,
|
zipCode: this.serviceZipCode,
|
||||||
state: resultMap.serviceZipValidationResponse.state,
|
state: resultMap.serviceZipValidationResponse.state,
|
||||||
|
zipCodeCtu: resultMap.serviceZipValidationResponse.zipCodeCtu,
|
||||||
},
|
},
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ describe("addressVehicles.vue", () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const { wrapper } = setupMocks({});
|
const { wrapper } = setupMocks({});
|
||||||
store.commit(storeMutations.UPDATE_CAR_ID, "NOT NULL");
|
store.commit(storeMutations.UPDATE_CAR_ID, "NOT NULL");
|
||||||
store.commit(storeMutations.UPDATE_SERVICE_LOCATION_ZIP_CODE, "12345");
|
store.commit(storeMutations.UPDATE_SERVICE_LOCATION, { zipCode: "12345" });
|
||||||
store.commit(storeMutations.UPDATE_CUSTOMER_EMAIL_ADDRESS, "test@test.com");
|
store.commit(storeMutations.UPDATE_CUSTOMER_EMAIL_ADDRESS, "test@test.com");
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
|
|
|
||||||
|
|
@ -174,9 +174,7 @@ export default {
|
||||||
).parts = partFromCapabilityQuestionAnswer;
|
).parts = partFromCapabilityQuestionAnswer;
|
||||||
}
|
}
|
||||||
|
|
||||||
// this.navigateForward(partsOrQuestions);
|
this.navigateForward(partsOrQuestions);
|
||||||
// TODO KO delete after quote MVP
|
|
||||||
this.navigateForward(partsOrQuestions, null, this.shouldGoToHeritageQuote);
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
|
|
|
||||||
|
|
@ -196,6 +196,7 @@ export default {
|
||||||
{
|
{
|
||||||
zipCode: this.serviceZipCode,
|
zipCode: this.serviceZipCode,
|
||||||
state: zipCodeData.state,
|
state: zipCodeData.state,
|
||||||
|
zipCodeCtu: zipCodeData.zipCodeCtu,
|
||||||
},
|
},
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -39,22 +39,20 @@ describe("license-plate-lookup.vue", () => {
|
||||||
describe("get values from store", () => {
|
describe("get values from store", () => {
|
||||||
test("getLicensePlateFromStore returns store license plate", async () => {
|
test("getLicensePlateFromStore returns store license plate", async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const { wrapper } = setupMocks({});
|
const licensePlateInput = "TEST129";
|
||||||
const mockLicensePlate = "TESTPLATE";
|
const { wrapper } = setupMocks({ licensePlate: licensePlateInput });
|
||||||
store.commit(storeMutations.UPDATE_REGISTRATION_LICENSE_PLATE, mockLicensePlate);
|
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
const licensePlate = wrapper.vm.getLicensePlateFromStore();
|
const licensePlate = wrapper.vm.getLicensePlateFromStore();
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
expect(licensePlate).toEqual(mockLicensePlate);
|
expect(licensePlate).toEqual(licensePlateInput);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("getRegistrationZipFromStore returns store registration zip", async () => {
|
test("getRegistrationZipFromStore returns store registration zip", async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const { wrapper } = setupMocks({});
|
const mockRegistrationZip = "77777";
|
||||||
const mockRegistrationZip = "12345";
|
const { wrapper } = setupMocks({ registrationZipCode: mockRegistrationZip });
|
||||||
store.commit(storeMutations.UPDATE_REGISTRATION_ZIP_CODE, mockRegistrationZip);
|
|
||||||
|
|
||||||
// ACT
|
// ACT
|
||||||
const registrationZip = wrapper.vm.getRegistrationZipFromStore();
|
const registrationZip = wrapper.vm.getRegistrationZipFromStore();
|
||||||
|
|
@ -65,9 +63,8 @@ describe("license-plate-lookup.vue", () => {
|
||||||
|
|
||||||
test("getEmailFromStore returns store customer email", async () => {
|
test("getEmailFromStore returns store customer email", async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const { wrapper } = setupMocks({});
|
const mockEmail = "test12345@test.com";
|
||||||
const mockEmail = "test@test.com";
|
const { wrapper } = setupMocks({ emailAddress: mockEmail });
|
||||||
store.commit(storeMutations.UPDATE_CUSTOMER_EMAIL_ADDRESS, mockEmail);
|
|
||||||
|
|
||||||
// ACT
|
// ACT
|
||||||
const customerEmail = wrapper.vm.getEmailFromStore();
|
const customerEmail = wrapper.vm.getEmailFromStore();
|
||||||
|
|
@ -78,15 +75,13 @@ describe("license-plate-lookup.vue", () => {
|
||||||
|
|
||||||
test("getServiceZipFromStore returns store service zip", async () => {
|
test("getServiceZipFromStore returns store service zip", async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const { wrapper } = setupMocks({});
|
const { wrapper } = setupMocks({ serviceLocationZipCode: "98765" });
|
||||||
const mockServiceZip = "12345";
|
|
||||||
store.commit(storeMutations.UPDATE_SERVICE_LOCATION_ZIP_CODE, mockServiceZip);
|
|
||||||
|
|
||||||
// ACT
|
// ACT
|
||||||
const serviceZip = wrapper.vm.getServiceZipFromStore();
|
const serviceZip = wrapper.vm.getServiceZipFromStore();
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
expect(serviceZip).toEqual(mockServiceZip);
|
expect(serviceZip).toEqual("98765");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -113,7 +108,15 @@ describe("license-plate-lookup.vue", () => {
|
||||||
test("Navigate forward should be called and isCarIdDifferent should be set to false when data entered matches store data on forwardButtonAction click", async () => {
|
test("Navigate forward should be called and isCarIdDifferent should be set to false when data entered matches store data on forwardButtonAction click", async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const mockCarId = "TESTID";
|
const mockCarId = "TESTID";
|
||||||
const { wrapper } = setupMocks({ carId: mockCarId, isServiceable: true });
|
const { wrapper } = setupMocks({
|
||||||
|
carId: mockCarId,
|
||||||
|
validateZipResponse: {
|
||||||
|
isServiceable: true,
|
||||||
|
isValid: true,
|
||||||
|
zipCodeCtu: "01820",
|
||||||
|
state: "OH",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
wrapper.vm.getCmsContent = jest.fn().mockImplementation(() => "");
|
wrapper.vm.getCmsContent = jest.fn().mockImplementation(() => "");
|
||||||
wrapper.vm.navigateForward = jest.fn();
|
wrapper.vm.navigateForward = jest.fn();
|
||||||
|
|
@ -180,7 +183,15 @@ describe("license-plate-lookup.vue", () => {
|
||||||
|
|
||||||
test("Navigate forward should be called and isCarId should be set to true when carId entered matches previously entered carId and rest of data entered matches store data on forwardButtonAction click", async () => {
|
test("Navigate forward should be called and isCarId should be set to true when carId entered matches previously entered carId and rest of data entered matches store data on forwardButtonAction click", async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const { wrapper } = setupMocks({ carId: "C10000", isServiceable: true });
|
const { wrapper } = setupMocks({
|
||||||
|
carId: "C10000",
|
||||||
|
validateZipResponse: {
|
||||||
|
isServiceable: true,
|
||||||
|
isValid: true,
|
||||||
|
zipCodeCtu: "01820",
|
||||||
|
state: "OH",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
wrapper.vm.getCmsContent = jest.fn().mockImplementation(() => {
|
wrapper.vm.getCmsContent = jest.fn().mockImplementation(() => {
|
||||||
return "";
|
return "";
|
||||||
|
|
@ -340,13 +351,34 @@ describe("license-plate-lookup.vue", () => {
|
||||||
|
|
||||||
describe("saving registrationZip and serviceZip on continue", () => {
|
describe("saving registrationZip and serviceZip on continue", () => {
|
||||||
test("registrationZip is serviceable and vehicle match is found => sets service zip/state to registration zip/state", async () => {
|
test("registrationZip is serviceable and vehicle match is found => sets service zip/state to registration zip/state", async () => {
|
||||||
|
// NEEDS FIX - Unsure what this test should be doing but it seems incorrect or at least very confusing. If you
|
||||||
|
// comment out the "Act" entirely, then the test passes which seems to say the test isn't testing anything
|
||||||
|
|
||||||
// Arrange
|
// Arrange
|
||||||
const { wrapper } = setupMocks({});
|
const { wrapper } = setupMocks({
|
||||||
|
validateZipResponse: {
|
||||||
|
isServiceable: true,
|
||||||
|
isValid: true,
|
||||||
|
zipCodeCtu: "01820",
|
||||||
|
state: "OH",
|
||||||
|
},
|
||||||
|
serviceLocationZipCode: "12345",
|
||||||
|
registrationZipCode: "12345",
|
||||||
|
});
|
||||||
|
|
||||||
wrapper.vm.getCmsContent = jest.fn().mockImplementation(() => "");
|
wrapper.vm.getCmsContent = jest.fn().mockImplementation(() => "");
|
||||||
|
|
||||||
await wrapper.setData({ registrationZipCode: "00000" });
|
await wrapper.setData({ registrationZipCode: "00000" });
|
||||||
navigateToHeritage.navigateToHeritageFunnel = jest.fn();
|
navigateToHeritage.navigateToHeritageFunnel = jest.fn();
|
||||||
|
|
||||||
|
wrapper.vm.lookupVinByPlate = jest.fn(() => {
|
||||||
|
return { data: { vehicle: { carId: "C00000" } } };
|
||||||
|
});
|
||||||
|
|
||||||
|
storeMutations.lookupVinByPlate = jest.fn().mockImplementation(() => {
|
||||||
|
return { data: { vehicle: { carId: "C00000" } } };
|
||||||
|
});
|
||||||
|
|
||||||
wrapper.vm.dispatchStoreAction = jest.fn().mockImplementation(() =>
|
wrapper.vm.dispatchStoreAction = jest.fn().mockImplementation(() =>
|
||||||
Promise.resolve({
|
Promise.resolve({
|
||||||
data: {
|
data: {
|
||||||
|
|
@ -364,13 +396,20 @@ describe("license-plate-lookup.vue", () => {
|
||||||
expect(wrapper.vm.$store.getters.order.serviceLocation.zipCode).toEqual(
|
expect(wrapper.vm.$store.getters.order.serviceLocation.zipCode).toEqual(
|
||||||
wrapper.vm.$store.getters.vehicle.registration.zipCode
|
wrapper.vm.$store.getters.vehicle.registration.zipCode
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(wrapper.vm.$store.getters.vehicle.registration.zipCode).toEqual("12345");
|
expect(wrapper.vm.$store.getters.vehicle.registration.zipCode).toEqual("12345");
|
||||||
expect(wrapper.vm.$store.getters.order.serviceLocation.zipCode).toEqual("12345");
|
expect(wrapper.vm.$store.getters.order.serviceLocation.zipCode).toEqual("12345");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("vehicle match is found but registrationZip is not serviceable => shows service zip/state field", async () => {
|
test("vehicle match is found but registrationZip is not serviceable => shows service zip/state field", async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const { wrapper } = setupMocks({});
|
// TODO FIX - seems like shouldn't have to set serviceLocationZipCode or registrationZipCode in state from the start
|
||||||
|
const { wrapper } = setupMocks({
|
||||||
|
validateZipResponse: { isServiceable: false, isValid: true },
|
||||||
|
serviceLocationZipCode: "12345",
|
||||||
|
registrationZipCode: "12345",
|
||||||
|
});
|
||||||
|
// 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(() => {
|
||||||
return { data: { isServiceable: false, state: "XX" } };
|
return { data: { isServiceable: false, state: "XX" } };
|
||||||
});
|
});
|
||||||
|
|
@ -388,6 +427,7 @@ describe("license-plate-lookup.vue", () => {
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//TODO FIX - test succeeds even if comment out the Act section
|
||||||
// Act
|
// Act
|
||||||
await wrapper.vm.forwardButtonAction();
|
await wrapper.vm.forwardButtonAction();
|
||||||
|
|
||||||
|
|
@ -440,20 +480,18 @@ 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({ isServiceable: false });
|
const { wrapper } = setupMocks({
|
||||||
|
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();
|
||||||
wrapper.vm.dispatchStoreAction = jest.fn().mockImplementation(() =>
|
|
||||||
Promise.resolve({
|
const vinLookup = { data: { vehicle: { carId: "TESTID1" } } };
|
||||||
data: {
|
wrapper.vm.lookupVin = jest.fn().mockImplementation(() => {
|
||||||
vehicle: {
|
return new Promise((resolve) => resolve(vinLookup));
|
||||||
carId: "C00000",
|
});
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
);
|
|
||||||
|
|
||||||
await wrapper.setData({ registrationZipCode: registrationZip });
|
await wrapper.setData({ registrationZipCode: registrationZip });
|
||||||
await wrapper.vm.forwardButtonAction();
|
await wrapper.vm.forwardButtonAction();
|
||||||
|
|
@ -476,20 +514,24 @@ describe("license-plate-lookup.vue", () => {
|
||||||
|
|
||||||
test("registrationZip is not serviceable so serviceZip field is shown, user enters serviceZip => service and registration zips/states saved", async () => {
|
test("registrationZip is not serviceable so serviceZip field is shown, user enters serviceZip => service and registration zips/states saved", async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const { wrapper } = setupMocks({ isServiceable: true });
|
|
||||||
|
// TODO FIX - This test only works because 12345 is set in the state store when setupMocks is called. If u change registrationZip or serviceZip
|
||||||
|
// to any other value, then the test fails. Driving this home is you can comment out the entire "Act" portion (and the expect navigate forward be called)'
|
||||||
|
// and the test still succeeds so the checking ZIP fields part doesn't work.
|
||||||
|
const { wrapper } = setupMocks({
|
||||||
|
validateZipResponse: { isServiceable: false, isValid: true },
|
||||||
|
//serviceLocationZipCode: "12345",
|
||||||
|
//registrationZipCode: "12345"
|
||||||
|
});
|
||||||
const registrationZip = "12345";
|
const registrationZip = "12345";
|
||||||
const serviceZip = "12345";
|
const serviceZip = "12345";
|
||||||
|
console.log("this is the test I care about");
|
||||||
|
|
||||||
wrapper.vm.navigateForward = jest.fn();
|
wrapper.vm.navigateForward = jest.fn();
|
||||||
wrapper.vm.dispatchStoreAction = jest.fn().mockImplementation(() =>
|
const vinLookup = { data: { vehicle: { carId: "TESTID1" } } };
|
||||||
Promise.resolve({
|
wrapper.vm.lookupVin = jest.fn().mockImplementation(() => {
|
||||||
data: {
|
return new Promise((resolve) => resolve(vinLookup));
|
||||||
vehicle: {
|
});
|
||||||
carId: "C00000",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
);
|
|
||||||
|
|
||||||
await wrapper.setData({ registrationZipCode: registrationZip });
|
await wrapper.setData({ registrationZipCode: registrationZip });
|
||||||
await wrapper.vm.forwardButtonAction();
|
await wrapper.vm.forwardButtonAction();
|
||||||
|
|
@ -497,15 +539,35 @@ describe("license-plate-lookup.vue", () => {
|
||||||
// At this point, serviceZip field is shown
|
// At this point, serviceZip field is shown
|
||||||
await wrapper.setData({ serviceZip: serviceZip });
|
await wrapper.setData({ serviceZip: serviceZip });
|
||||||
|
|
||||||
|
const apiResponses = {
|
||||||
|
serviceZipValidationResponse: {
|
||||||
|
isValid: true,
|
||||||
|
isServiceable: true,
|
||||||
|
state: "OH",
|
||||||
|
zipCodeCtu: "01820",
|
||||||
|
},
|
||||||
|
registrationZipValidationResponse: {
|
||||||
|
isValid: true,
|
||||||
|
isServiceable: false,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const apiPromise = Promise.resolve(apiResponses);
|
||||||
|
|
||||||
|
settleAllPromises.mockImplementation(() => apiPromise);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
|
|
||||||
// Continue after entering value into service zip field
|
// Continue after entering value into service zip field
|
||||||
await wrapper.vm.forwardButtonAction();
|
await wrapper.vm.forwardButtonAction();
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
expect(wrapper.vm.$store.getters.vehicle.registration.zipCode).toEqual(registrationZip);
|
// TODO - these two values have a value in pages "data" but not setting it in store; need to figure out why or mock it or something
|
||||||
expect(wrapper.vm.$store.getters.order.serviceLocation.zipCode).toEqual(serviceZip);
|
//expect(wrapper.vm.$store.vehicle.registration.zipCode).toEqual(registrationZip);
|
||||||
expect(wrapper.vm.navigateForward).toHaveBeenCalled();
|
//expect(wrapper.vm.$store.order.serviceLocation.zipCode).toEqual(serviceZip);
|
||||||
|
|
||||||
|
//Verify we only navigateForward one time despite our calling forwardButtonAction twice
|
||||||
|
expect(wrapper.vm.navigateForward).toBeCalledTimes(1);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -529,6 +591,25 @@ describe("license-plate-lookup.vue", () => {
|
||||||
//Assert
|
//Assert
|
||||||
expect(arePagePrerequisitesValid).toBe(true);
|
expect(arePagePrerequisitesValid).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("CarId not set, arePagePrerequisitesValid should be false ", async () => {
|
||||||
|
//Arrange
|
||||||
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
|
//Act
|
||||||
|
licensePlateLookup.beforeRouteEnter.call(
|
||||||
|
wrapper.vm,
|
||||||
|
{ query: { fmgPage: "license-plate-lookup" } },
|
||||||
|
undefined,
|
||||||
|
(c) => c(wrapper.vm)
|
||||||
|
);
|
||||||
|
|
||||||
|
let arePagePrerequisitesValid = wrapper.vm.arePagePrerequisitesValid();
|
||||||
|
await nextTick();
|
||||||
|
|
||||||
|
//Assert
|
||||||
|
expect(arePagePrerequisitesValid).toBe(false);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -536,8 +617,13 @@ function setupMocks({
|
||||||
pageHeaderWidgetHeaderText = {},
|
pageHeaderWidgetHeaderText = {},
|
||||||
mountOptionsMockData = {},
|
mountOptionsMockData = {},
|
||||||
partsOrQuestions = [],
|
partsOrQuestions = [],
|
||||||
isServiceable = false,
|
validateZipResponse = { zipCodeCtu: null, isServiceable: false, isValid: true, state: null },
|
||||||
carId = "",
|
//Values to set in the state store
|
||||||
|
carId = null,
|
||||||
|
serviceLocationZipCode = null,
|
||||||
|
registrationZipCode = null,
|
||||||
|
licensePlate = null, //"TESTPLATE",
|
||||||
|
emailAddress = null, //"test@test.com"
|
||||||
}) {
|
}) {
|
||||||
store.commit(storeMutations.RESET_STATE);
|
store.commit(storeMutations.RESET_STATE);
|
||||||
//Mock api responses
|
//Mock api responses
|
||||||
|
|
@ -554,11 +640,16 @@ function setupMocks({
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
serviceZipValidationResponse: {
|
serviceZipValidationResponse: {
|
||||||
isValid: true,
|
isValid: validateZipResponse.isValid,
|
||||||
isServiceable: isServiceable,
|
isServiceable: validateZipResponse.isServiceable,
|
||||||
|
state: validateZipResponse.state,
|
||||||
|
zipCodeCtu: validateZipResponse.zipCodeCtu,
|
||||||
},
|
},
|
||||||
registrationZipValidationResponse: {
|
registrationZipValidationResponse: {
|
||||||
state: "CO",
|
isValid: validateZipResponse.isValid,
|
||||||
|
isServiceable: validateZipResponse.isServiceable,
|
||||||
|
state: validateZipResponse.state,
|
||||||
|
zipCodeCtu: validateZipResponse.zipCodeCtu,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -573,17 +664,17 @@ function setupMocks({
|
||||||
getters: {
|
getters: {
|
||||||
vehicle: {
|
vehicle: {
|
||||||
registration: {
|
registration: {
|
||||||
licensePlate: "TESTPLATE",
|
licensePlate: licensePlate,
|
||||||
zipCode: "12345",
|
zipCode: registrationZipCode,
|
||||||
},
|
},
|
||||||
carId: carId,
|
carId: carId,
|
||||||
},
|
},
|
||||||
order: {
|
order: {
|
||||||
customer: {
|
customer: {
|
||||||
emailAddress: "test@test.com",
|
emailAddress: emailAddress,
|
||||||
},
|
},
|
||||||
serviceLocation: {
|
serviceLocation: {
|
||||||
zipCode: "12345",
|
zipCode: serviceLocationZipCode,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -212,6 +212,7 @@ export default {
|
||||||
promise: registrationZipValidationResponse,
|
promise: registrationZipValidationResponse,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
// If serviceZipCode is not set, then sets the response to the registrationZipValidationResponse. Calls VALIDATE_ZIP if the serviceZipCode is set.
|
||||||
resultKey: "serviceZipValidationResponse",
|
resultKey: "serviceZipValidationResponse",
|
||||||
promise: this.serviceZipCode
|
promise: this.serviceZipCode
|
||||||
? this.dispatchStoreAction(storeActions.VALIDATE_ZIP, {
|
? this.dispatchStoreAction(storeActions.VALIDATE_ZIP, {
|
||||||
|
|
@ -224,13 +225,9 @@ export default {
|
||||||
const resultMap = await settleAllPromises(promiseResultMap);
|
const resultMap = await settleAllPromises(promiseResultMap);
|
||||||
|
|
||||||
// Lookup vin
|
// Lookup vin
|
||||||
const vinLookup = await this.dispatchStoreAction(
|
const vinLookup = await this.lookupVin(
|
||||||
storeActions.LOOKUP_VIN_BY_PLATE,
|
this.licensePlate,
|
||||||
{
|
resultMap.registrationZipValidationResponse.state
|
||||||
licensePlate: this.licensePlate,
|
|
||||||
licenseState: resultMap.registrationZipValidationResponse.state,
|
|
||||||
},
|
|
||||||
false
|
|
||||||
).catch(() => {
|
).catch(() => {
|
||||||
// No VIN found.
|
// No VIN found.
|
||||||
this.displayVinNotFoundAlert = true;
|
this.displayVinNotFoundAlert = true;
|
||||||
|
|
@ -309,12 +306,20 @@ export default {
|
||||||
{
|
{
|
||||||
zipCode: this.serviceZipCode,
|
zipCode: this.serviceZipCode,
|
||||||
state: resultMap.serviceZipValidationResponse.state,
|
state: resultMap.serviceZipValidationResponse.state,
|
||||||
|
zipCodeCtu: resultMap.serviceZipValidationResponse.zipCodeCtu,
|
||||||
},
|
},
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
|
||||||
return await this.navigateForward();
|
return await this.navigateForward();
|
||||||
},
|
},
|
||||||
|
lookupVin(plate, state) {
|
||||||
|
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) {
|
||||||
this.$router.navigateWithSaving(
|
this.$router.navigateWithSaving(
|
||||||
|
|
|
||||||
|
|
@ -158,9 +158,7 @@ export default {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
// this.navigateForward(partsOrQuestions);
|
this.navigateForward(partsOrQuestions);
|
||||||
// TODO KO delete after quote MVP
|
|
||||||
this.navigateForward(partsOrQuestions, null, this.shouldGoToHeritageQuote);
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
|
|
|
||||||
|
|
@ -130,9 +130,11 @@ export default {
|
||||||
methods: {
|
methods: {
|
||||||
arePagePrerequisitesValid() {
|
arePagePrerequisitesValid() {
|
||||||
return (
|
return (
|
||||||
store.getters.order.damage.isRepair ||
|
store.getters.order.serviceLocation.zipCode &&
|
||||||
(store.getters.order.lineItems?.glassParts != null &&
|
store.getters.order.serviceLocation.zipCodeCtu &&
|
||||||
store.getters.order.lineItems.glassParts.length > 0)
|
(store.getters.order.damage.isRepair ||
|
||||||
|
(store.getters.order.lineItems?.glassParts != null &&
|
||||||
|
store.getters.order.lineItems.glassParts.length > 0))
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
getDefaultIsInsuranceSelectedValue() {
|
getDefaultIsInsuranceSelectedValue() {
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,6 @@
|
||||||
cmsWidgetName="FunnelFooterWidget"
|
cmsWidgetName="FunnelFooterWidget"
|
||||||
ref="funnelFooter"
|
ref="funnelFooter"
|
||||||
:isForwardActionDisabled="isForwardActionDisabled"
|
:isForwardActionDisabled="isForwardActionDisabled"
|
||||||
@tempButtonClicked="() => handleTempButtonClicked(this)"
|
|
||||||
@back-click="navigateBack"
|
@back-click="navigateBack"
|
||||||
@ForwardClicked="forwardButtonAction" />
|
@ForwardClicked="forwardButtonAction" />
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -189,10 +188,8 @@ export default {
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
|
||||||
// TODO KO delete after quote MVP
|
|
||||||
this.navigateForward(matchedParts, null, this.shouldGoToHeritageQuote);
|
|
||||||
// Navigate to the next page
|
// Navigate to the next page
|
||||||
// this.navigateForward(matchedParts);
|
this.navigateForward(matchedParts);
|
||||||
},
|
},
|
||||||
|
|
||||||
LoadInitialPartsData() {
|
LoadInitialPartsData() {
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,6 @@
|
||||||
cmsWidgetName="FunnelFooterWidget"
|
cmsWidgetName="FunnelFooterWidget"
|
||||||
ref="funnelFooter"
|
ref="funnelFooter"
|
||||||
:isForwardActionDisabled="!meta.valid"
|
:isForwardActionDisabled="!meta.valid"
|
||||||
@tempButtonClicked="() => handleTempButtonClicked(this)"
|
|
||||||
@back-clicked="backButtonAction"
|
@back-clicked="backButtonAction"
|
||||||
@ForwardClicked="forwardButtonAction" />
|
@ForwardClicked="forwardButtonAction" />
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -315,6 +314,7 @@ export default {
|
||||||
{
|
{
|
||||||
zipCode: this.serviceZipCode,
|
zipCode: this.serviceZipCode,
|
||||||
state: resultMap.zipCodeData.state,
|
state: resultMap.zipCodeData.state,
|
||||||
|
zipCodeCtu: resultMap.zipCodeData.zipCodeCtu,
|
||||||
},
|
},
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
|
@ -347,6 +347,7 @@ export default {
|
||||||
{
|
{
|
||||||
zipCode: this.serviceZipCode,
|
zipCode: this.serviceZipCode,
|
||||||
state: zipCodeData.state,
|
state: zipCodeData.state,
|
||||||
|
zipCodeCtu: zipCodeData.zipCodeCtu,
|
||||||
},
|
},
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -60,6 +60,7 @@ export default {
|
||||||
isValid: serviceZipValidationResponse.data.isValid,
|
isValid: serviceZipValidationResponse.data.isValid,
|
||||||
isServiceable: serviceZipValidationResponse.data.isServiceable,
|
isServiceable: serviceZipValidationResponse.data.isServiceable,
|
||||||
state: serviceZipValidationResponse.data.state,
|
state: serviceZipValidationResponse.data.state,
|
||||||
|
zipCodeCtu: serviceZipValidationResponse.data.zipCodeCtu,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
getTierOnePackagePrice(lineItems) {
|
getTierOnePackagePrice(lineItems) {
|
||||||
|
|
|
||||||
|
|
@ -7,12 +7,6 @@ import baseMixin from "@/mixins/base-mixin.js";
|
||||||
import store from "@/store";
|
import store from "@/store";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
|
||||||
// TODO KO DELETE AFTER QUOTE MVP
|
|
||||||
return {
|
|
||||||
shouldGoToHeritageQuote: false,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
hasPartQuestions(partsOrQuestions) {
|
hasPartQuestions(partsOrQuestions) {
|
||||||
return partsOrQuestions?.some((pq) => pq.partQuestions?.length > 0);
|
return partsOrQuestions?.some((pq) => pq.partQuestions?.length > 0);
|
||||||
|
|
@ -353,9 +347,8 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// TODO KO Delete `shouldGoToHeritageQuote`
|
|
||||||
// Can't use `this` because navigateForward is also called from vin-pages-mixin
|
// Can't use `this` because navigateForward is also called from vin-pages-mixin
|
||||||
async navigateForward(partsOrQuestions, vm, shouldGoToHeritageQuote) {
|
async navigateForward(partsOrQuestions, vm) {
|
||||||
const self = vm ?? this;
|
const self = vm ?? this;
|
||||||
const currentPage = self.$route.query.fmgPage;
|
const currentPage = self.$route.query.fmgPage;
|
||||||
|
|
||||||
|
|
@ -450,13 +443,15 @@ export default {
|
||||||
self.$store.commit(storeMutations.UPDATE_GLASS_PARTS, collectedGlassParts);
|
self.$store.commit(storeMutations.UPDATE_GLASS_PARTS, collectedGlassParts);
|
||||||
|
|
||||||
const payment = store.getters.payment;
|
const payment = store.getters.payment;
|
||||||
shouldGoToHeritageQuote ||
|
|
||||||
(payment.isInsurance && payment.insuranceCoverage.isVerified)
|
if (payment.isInsurance && payment.insuranceCoverage.isVerified) {
|
||||||
? navigateToHeritageFunnel({ loadingModal: self.$refs.loadingModal })
|
navigateToHeritageFunnel({ loadingModal: self.$refs.loadingModal });
|
||||||
: self.$router.navigateWithSaving(
|
} else {
|
||||||
self.navigationScenarios.CLICKED_FORWARD_WITH_NO_MORE_QUESTIONS,
|
self.$router.navigateWithSaving(
|
||||||
self.$route
|
self.navigationScenarios.CLICKED_FORWARD_WITH_NO_MORE_QUESTIONS,
|
||||||
);
|
self.$route
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// Can't use `this` because navigateForward is also called from quote
|
// Can't use `this` because navigateForward is also called from quote
|
||||||
|
|
@ -530,9 +525,5 @@ export default {
|
||||||
|
|
||||||
self.$router.navigateWithoutSaving(backNavigationScenario, self.$route);
|
self.$router.navigateWithoutSaving(backNavigationScenario, self.$route);
|
||||||
},
|
},
|
||||||
// TODO KO delete this after quote mvp
|
|
||||||
async handleTempButtonClicked(vm) {
|
|
||||||
this.shouldGoToHeritageQuote = true;
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -4,12 +4,6 @@ import vehicleQuestionsMixin from "@/mixins/vehicle-questions-mixin";
|
||||||
import { saveSession } from "@/helpers/heritage-integration/order-helper.js";
|
import { saveSession } from "@/helpers/heritage-integration/order-helper.js";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
|
||||||
// TODO KO DELETE AFTER QUOTE MVP
|
|
||||||
return {
|
|
||||||
shouldGoToHeritageQuote: false,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
async navigateForwardWithSingleCarMatch() {
|
async navigateForwardWithSingleCarMatch() {
|
||||||
// If we have not already saved a session, we need to save one now before the lengthy call to getPartsOrQuestions
|
// If we have not already saved a session, we need to save one now before the lengthy call to getPartsOrQuestions
|
||||||
|
|
@ -20,17 +14,7 @@ export default {
|
||||||
const result = await this.dispatchStoreAction(storeActions.GET_PARTS_OR_QUESTIONS);
|
const result = await this.dispatchStoreAction(storeActions.GET_PARTS_OR_QUESTIONS);
|
||||||
const partsOrQuestions = result.data.partsOrQuestions;
|
const partsOrQuestions = result.data.partsOrQuestions;
|
||||||
|
|
||||||
// TODO KO delete `this.shouldGoToHeritageQuote`
|
vehicleQuestionsMixin.methods.navigateForward(partsOrQuestions, this);
|
||||||
vehicleQuestionsMixin.methods.navigateForward(
|
|
||||||
partsOrQuestions,
|
|
||||||
this,
|
|
||||||
this.shouldGoToHeritageQuote
|
|
||||||
);
|
|
||||||
},
|
|
||||||
// TODO KO delete this after quote mvp
|
|
||||||
async handleTempButtonClicked(vm) {
|
|
||||||
this.shouldGoToHeritageQuote = true;
|
|
||||||
await vm.forwardButtonAction();
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,7 @@ const getDefaultState = () => {
|
||||||
city: null,
|
city: null,
|
||||||
state: null,
|
state: null,
|
||||||
zipCode: null,
|
zipCode: null,
|
||||||
|
zipCodeCtu: null,
|
||||||
},
|
},
|
||||||
customer: {
|
customer: {
|
||||||
emailAddress: null,
|
emailAddress: null,
|
||||||
|
|
@ -187,12 +188,6 @@ export const mutations = {
|
||||||
updateRegistrationZipCode(state, registrationZipCode) {
|
updateRegistrationZipCode(state, registrationZipCode) {
|
||||||
state.order.vehicle.registration.zipCode = registrationZipCode;
|
state.order.vehicle.registration.zipCode = registrationZipCode;
|
||||||
},
|
},
|
||||||
updateServiceLocationZipCode(state, serviceLocationZip) {
|
|
||||||
state.order.serviceLocation.zipCode = serviceLocationZip;
|
|
||||||
},
|
|
||||||
updateServiceLocationState(state, serviceLocationState) {
|
|
||||||
state.order.serviceLocation.state = serviceLocationState;
|
|
||||||
},
|
|
||||||
updateRegistrationFirstName(state, firstName) {
|
updateRegistrationFirstName(state, firstName) {
|
||||||
state.order.vehicle.registration.firstName = firstName;
|
state.order.vehicle.registration.firstName = firstName;
|
||||||
},
|
},
|
||||||
|
|
@ -229,6 +224,7 @@ export const mutations = {
|
||||||
state.order.serviceLocation.city = serviceLocationInfo.city;
|
state.order.serviceLocation.city = serviceLocationInfo.city;
|
||||||
state.order.serviceLocation.state = serviceLocationInfo.state;
|
state.order.serviceLocation.state = serviceLocationInfo.state;
|
||||||
state.order.serviceLocation.zipCode = serviceLocationInfo.zipCode;
|
state.order.serviceLocation.zipCode = serviceLocationInfo.zipCode;
|
||||||
|
state.order.serviceLocation.zipCodeCtu = serviceLocationInfo.zipCodeCtu;
|
||||||
},
|
},
|
||||||
|
|
||||||
// applicationUser MUTATIONS
|
// applicationUser MUTATIONS
|
||||||
|
|
@ -355,7 +351,9 @@ export const mutations = {
|
||||||
(state.order.serviceLocation.city = sessionInformation.order.serviceLocation.city),
|
(state.order.serviceLocation.city = sessionInformation.order.serviceLocation.city),
|
||||||
(state.order.serviceLocation.state = sessionInformation.order.serviceLocation.state),
|
(state.order.serviceLocation.state = sessionInformation.order.serviceLocation.state),
|
||||||
(state.order.serviceLocation.zipCode =
|
(state.order.serviceLocation.zipCode =
|
||||||
sessionInformation.order.serviceLocation.zipCode);
|
sessionInformation.order.serviceLocation.zipCode),
|
||||||
|
(state.order.serviceLocation.zipCodeCtu =
|
||||||
|
sessionInformation.order.serviceLocation.zipCodeCtu);
|
||||||
|
|
||||||
state.order.payment.isInsurance = sessionInformation.order.payment.isInsurance;
|
state.order.payment.isInsurance = sessionInformation.order.payment.isInsurance;
|
||||||
state.order.payment.insuranceCoverage.isVerified =
|
state.order.payment.insuranceCoverage.isVerified =
|
||||||
|
|
@ -906,14 +904,14 @@ export const actions = {
|
||||||
const carId = context.getters.vehicle.carId;
|
const carId = context.getters.vehicle.carId;
|
||||||
const isRepair = context.getters.damage.isRepair;
|
const isRepair = context.getters.damage.isRepair;
|
||||||
const numberOfChips = context.getters.damage.numberOfChips;
|
const numberOfChips = context.getters.damage.numberOfChips;
|
||||||
const parentAccountNumber = context.getters.order.accountNumber.toString();
|
|
||||||
return globalMethods.callHttpClient({
|
return globalMethods.callHttpClient({
|
||||||
method: endpoints.GetSupportingItems.method,
|
method: endpoints.GetSupportingItems.method,
|
||||||
endpoint: endpoints.GetSupportingItems.url,
|
endpoint: endpoints.GetSupportingItems.url,
|
||||||
payload: {
|
payload: {
|
||||||
carId: carId,
|
carId: carId,
|
||||||
serviceType: isRepair ? "Repair" : "Replace",
|
serviceType: isRepair ? "Repair" : "Replace",
|
||||||
parentAccountNumber: parentAccountNumber,
|
parentAccountNumber: applicationConfig.CASH_ACCOUNT_NUMBER,
|
||||||
parts: glassPartsArray,
|
parts: glassPartsArray,
|
||||||
numberOfRepairChips: isRepair ? numberOfChips : 0,
|
numberOfRepairChips: isRepair ? numberOfChips : 0,
|
||||||
},
|
},
|
||||||
|
|
@ -1010,13 +1008,14 @@ export const actions = {
|
||||||
},
|
},
|
||||||
isInsurance: order.payment.isInsurance ?? false,
|
isInsurance: order.payment.isInsurance ?? false,
|
||||||
},
|
},
|
||||||
accountNumber: order.accountNumber?.toString(),
|
accountNumber: order.accountNumber,
|
||||||
providerNumber: "",
|
providerNumber: "",
|
||||||
serviceLocation: {
|
serviceLocation: {
|
||||||
streetAddress: order.serviceLocation.address,
|
streetAddress: order.serviceLocation.address,
|
||||||
city: order.serviceLocation.city,
|
city: order.serviceLocation.city,
|
||||||
state: order.serviceLocation.state,
|
state: order.serviceLocation.state,
|
||||||
zipCode: order.serviceLocation.zipCode,
|
zipCode: order.serviceLocation.zipCode,
|
||||||
|
zipCodeCtu: order.serviceLocation.zipCodeCtu,
|
||||||
},
|
},
|
||||||
existingPromoCode: null,
|
existingPromoCode: null,
|
||||||
referralCorrelationId: order.referralCorrelationId,
|
referralCorrelationId: order.referralCorrelationId,
|
||||||
|
|
|
||||||
|
|
@ -312,6 +312,28 @@ describe("Mutations", () => {
|
||||||
// Assert
|
// Assert
|
||||||
expect(storeState.applicationUser.triggeredSiteEntry).toEqual(true);
|
expect(storeState.applicationUser.triggeredSiteEntry).toEqual(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("updateServiceLocation, should set serviceLocation in state", () => {
|
||||||
|
// Arrange
|
||||||
|
const storeState = state;
|
||||||
|
const serviceLocation = {
|
||||||
|
address: "123 Test Lane",
|
||||||
|
city: "Columbus",
|
||||||
|
zipCode: "43212",
|
||||||
|
state: "OH",
|
||||||
|
zipCodeCtu: "01820",
|
||||||
|
};
|
||||||
|
|
||||||
|
// Act
|
||||||
|
mutations.updateServiceLocation(storeState, serviceLocation);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(storeState.order.serviceLocation.address).toEqual("123 Test Lane");
|
||||||
|
expect(storeState.order.serviceLocation.city).toEqual("Columbus");
|
||||||
|
expect(storeState.order.serviceLocation.zipCode).toEqual("43212");
|
||||||
|
expect(storeState.order.serviceLocation.state).toEqual("OH");
|
||||||
|
expect(storeState.order.serviceLocation.zipCodeCtu).toEqual("01820");
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("Actions", () => {
|
describe("Actions", () => {
|
||||||
|
|
@ -357,13 +379,13 @@ describe("Actions", () => {
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
globalMethods.callHttpClient.mockImplementation(() => {
|
globalMethods.callHttpClient.mockImplementation(() => {
|
||||||
return Promise.resolve({ data: { carId: "C00000001" } });
|
return Promise.resolve({ data: { carId: "C0000001" } });
|
||||||
});
|
});
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
const response = await actions.lookupVehicleByVin(context, "12345678901234567");
|
const response = await actions.lookupVehicleByVin(context, "12345678901234567");
|
||||||
|
|
||||||
expect(response.data).toEqual({ carId: "C00000001" });
|
expect(response.data).toEqual({ carId: "C0000001" });
|
||||||
});
|
});
|
||||||
|
|
||||||
it("lookupVinByPlate action, should return car data", async () => {
|
it("lookupVinByPlate action, should return car data", async () => {
|
||||||
|
|
@ -467,13 +489,25 @@ describe("Actions", () => {
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
globalMethods.callHttpClient.mockImplementation(() => {
|
globalMethods.callHttpClient.mockImplementation(() => {
|
||||||
return Promise.resolve({ data: "43201" });
|
return Promise.resolve({
|
||||||
|
data: {
|
||||||
|
isValid: true,
|
||||||
|
isServiceable: true,
|
||||||
|
state: "OH",
|
||||||
|
zipCodeCtu: "01820",
|
||||||
|
},
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
const response = await actions.validateZip(context, "C00000000");
|
const response = await actions.validateZip(context, "43212");
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
expect(response.data).toEqual("43201");
|
expect(response.data).toEqual({
|
||||||
|
isValid: true,
|
||||||
|
isServiceable: true,
|
||||||
|
state: "OH",
|
||||||
|
zipCodeCtu: "01820",
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it("resetDamageAndDependencies action", async () => {
|
it("resetDamageAndDependencies action", async () => {
|
||||||
|
|
@ -866,18 +900,30 @@ describe("Actions", () => {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("saveServiceLocation, should call mutation", () => {
|
it("saveServiceLocation, should call mutation and save service address to state", () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const context = state;
|
const context = state;
|
||||||
const commit = jest.fn();
|
const commit = jest.fn();
|
||||||
|
|
||||||
context.commit = commit;
|
context.commit = commit;
|
||||||
|
|
||||||
|
const serviceLocation = {
|
||||||
|
address: "123 Test Lane",
|
||||||
|
city: "Columbus",
|
||||||
|
zipCode: "43212",
|
||||||
|
state: "OH",
|
||||||
|
zipCodeCtu: "01820",
|
||||||
|
};
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
actions.saveServiceLocation(context, { zipCode: "80020" });
|
actions.saveServiceLocation(context, serviceLocation);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
expect(commit).toBeCalledWith(storeMutations.UPDATE_SERVICE_LOCATION, { zipCode: "80020" });
|
expect(commit).toBeCalledWith(storeMutations.UPDATE_SERVICE_LOCATION, serviceLocation);
|
||||||
|
expect(state.order.serviceLocation.address).toEqual("123 Test Lane");
|
||||||
|
expect(state.order.serviceLocation.city).toEqual("Columbus");
|
||||||
|
expect(state.order.serviceLocation.zipCode).toEqual("43212");
|
||||||
|
expect(state.order.serviceLocation.state).toEqual("OH");
|
||||||
|
expect(state.order.serviceLocation.zipCodeCtu).toEqual("01820");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("saveGlassParts, should call mutation", () => {
|
it("saveGlassParts, should call mutation", () => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue