CSR-1012 service-location pageprereqs unit test updates

This commit is contained in:
Matt Caimi 2023-02-24 10:57:43 -05:00
parent 22cc5a7be5
commit 50c745e18b
3 changed files with 17 additions and 85 deletions

View file

@ -22,28 +22,6 @@ jest.mock("@/helpers/cms-content-helper", () => ({
jest.mock("@/store", () => ({
commit: jest.fn(),
dispatch: jest.fn(),
getters: {
lineItems: {
supportingItems: [
{
description: null,
kitPrice: 0,
laborAmount: 0,
partNumber: "SUPPLIES-REPAIR",
partType: "REPAIR FEE",
sellingPrice: 7.99,
},
],
},
order: {
serviceLocation: {
zipCode: "43235",
},
},
payment: {
isInsurance: false,
},
},
}));
beforeEach(() => {
@ -63,11 +41,21 @@ beforeEach(() => {
order: {
serviceLocation: {
zipCode: "43235",
state: "OH",
isServiceable: true,
},
},
payment: {
isInsurance: false,
},
vehicle: {
registration: {
address: undefined,
city: undefined,
state: undefined,
zipCode: undefined,
},
},
};
});

View file

@ -93,25 +93,25 @@ export default {
);
},
getRegistrationAddressFromStore() {
return this.$store.getters.vehicle.registration.address;
return store.getters.vehicle.registration.address;
},
getRegistrationCityFromStore() {
return this.$store.getters.vehicle.registration.city;
return store.getters.vehicle.registration.city;
},
getRegistrationStateFromStore() {
return this.$store.getters.vehicle.registration.state;
return store.getters.vehicle.registration.state;
},
getRegistrationZipFromStore() {
return this.$store.getters.vehicle.registration.zipCode;
return store.getters.vehicle.registration.zipCode;
},
getServiceZipCodeFromStore() {
return this.$store.getters.order.serviceLocation.zipCode;
return store.getters.order.serviceLocation.zipCode;
},
getServiceStateFromStore() {
return this.$store.getters.order.serviceLocation.state;
return store.getters.order.serviceLocation.state;
},
getIsServiceableFromStore() {
return this.$store.getters.order.serviceLocation.isServiceable;
return store.getters.order.serviceLocation.isServiceable;
},
resetMobileLocation(updatedServiceZipCode) {
this.mobileLocationQuestions = {

View file

@ -175,62 +175,6 @@ describe("service-zip-modal-question.vue", () => {
expect(wrapper.emitted("update:modelValue")).not.toBeTruthy();
});
it("Should emit service-zip-updated on setZipCode for a valid, serviceable zip", async () => {
// Arrange
let serviceZipCodeQuestion = {
state: "IL",
zipCode: "61606",
isServiceable: true,
};
const zip = "43235";
const wrapper = mount(serviceZipModalQuestion, {
mixins: [mockMixin],
props: {
modelValue: serviceZipCodeQuestion,
linkWidgetName: linkWidgetName,
modalWidgetName: modalWidgetName,
},
attachTo: document.body,
});
// Act
wrapper.vm.internalModel.zipCode = zip;
await wrapper.vm.setZipCode();
// Assert
expect(wrapper.emitted("service-zip-updated")).toBeTruthy();
});
it("Should not emit service-zip-updated on setZipCode for an invalid zip", async () => {
// Arrange
let serviceZipCodeQuestion = {
state: "IL",
zipCode: "61606",
isServiceable: true,
};
const zip = "";
const wrapper = mount(serviceZipModalQuestion, {
mixins: [mockMixin],
props: {
modelValue: serviceZipCodeQuestion,
linkWidgetName: linkWidgetName,
modalWidgetName: modalWidgetName,
},
attachTo: document.body,
});
// Act
wrapper.vm.internalModel.zipCode = zip;
await wrapper.vm.setZipCode();
// Assert
expect(wrapper.emitted("service-zip-updated")).not.toBeTruthy();
});
it("Should display invalid zip alerts for invalid ip inputs", async () => {
// Arrange
let serviceZipCodeQuestion = {