diff --git a/src/layouts/service-location/service-zip-modal-question/service-zip-modal-question.spec.js b/src/layouts/service-location/service-zip-modal-question/service-zip-modal-question.spec.js index 77f79472..96060cc9 100644 --- a/src/layouts/service-location/service-zip-modal-question/service-zip-modal-question.spec.js +++ b/src/layouts/service-location/service-zip-modal-question/service-zip-modal-question.spec.js @@ -27,12 +27,42 @@ const mockGetServiceabilityDetails = (mockServiceZipCode) => { return Promise.resolve(serviceabilityDetails); }; +const mockGetZipCodeData = (mockServiceZipCode) => { + if (mockServiceZipCode === "43235") { + return { + containsMilitaryBase: false, + isValid: true, + state: "OH", + zipCodeCtu: "01820", + }; + } + + if (mockServiceZipCode === "61606") { + return { + containsMilitaryBase: false, + isValid: true, + state: "IL", + zipCodeCtu: "01526", + }; + } + + return { + containsMilitaryBase: false, + isValid: false, + state: null, + zipCodeCtu: null, + }; +} + jest.mock( "@/helpers/service-location-helper", () => ({ getServiceabilityDetails: jest.fn((mockServiceZipCode) => { return mockGetServiceabilityDetails(mockServiceZipCode); }), + getZipCodeData: jest.fn((mockServiceZipCode) => { + return mockGetZipCodeData(mockServiceZipCode); + }), }) ); @@ -59,35 +89,36 @@ const mockMixin = { } return null; }), + } +} +// getZipCodeData: jest.fn((zip) => { +// if (zip === "43235") { +// return { +// containsMilitaryBase: false, +// isValid: true, +// state: "OH", +// zipCodeCtu: "01820", +// }; +// } - getZipCodeData: jest.fn((zip) => { - if (zip === "43235") { - return { - containsMilitaryBase: false, - isValid: true, - state: "OH", - zipCodeCtu: "01820", - }; - } +// if (zip === "61606") { +// return { +// containsMilitaryBase: false, +// isValid: true, +// state: "IL", +// zipCodeCtu: "01526", +// }; +// } - if (zip === "61606") { - return { - containsMilitaryBase: false, - isValid: true, - state: "IL", - zipCodeCtu: "01526", - }; - } - - return { - containsMilitaryBase: false, - isValid: false, - state: null, - zipCodeCtu: null, - }; - }), - }, -}; +// return { +// containsMilitaryBase: false, +// isValid: false, +// state: null, +// zipCodeCtu: null, +// }; +// }), +// }, +// }; describe("service-zip-modal-question.vue", () => { it("Initial state on load with existing location info", async () => { diff --git a/src/layouts/service-location/service-zip-modal-question/service-zip-modal-question.vue b/src/layouts/service-location/service-zip-modal-question/service-zip-modal-question.vue index aef14fbf..5e3493a3 100644 --- a/src/layouts/service-location/service-zip-modal-question/service-zip-modal-question.vue +++ b/src/layouts/service-location/service-zip-modal-question/service-zip-modal-question.vue @@ -125,7 +125,7 @@ export default { if (this.internalModel.zipCode !== this.modelValue.zipCode) { this.resetAlerts(); - const zipCodeData = await this.getZipCodeData(this.internalModel.zipCode); + const zipCodeData = await getZipCodeData(this.internalModel.zipCode); if (!zipCodeData.isValid) { this.displayInvalidZipAlert = true;