diff --git a/src/layouts/service-location/service-location.spec.js b/src/layouts/service-location/service-location.spec.js index 9870e1f0d..05608f89f 100644 --- a/src/layouts/service-location/service-location.spec.js +++ b/src/layouts/service-location/service-location.spec.js @@ -42,12 +42,12 @@ jest.mock( ); jest.spyOn(baseMixin.methods, "getZipCodeData").mockImplementation((serviceZipCode) => { - let moqContainsMilitaryBase = false; - if (serviceZipCode === 45433) { - moqContainsMilitaryBase = true; - } return new Promise((resolve) => { - resolve({ containsMilitaryBase: moqContainsMilitaryBase, isValid: true, isServiceable: true, state: "OH", zipCodeCtu: "01820" }); + let mockContainsMilitaryBase = false; + if (serviceZipCode === 45433 || serviceZipCode === '45433') { + mockContainsMilitaryBase = true; + } + resolve({ containsMilitaryBase: mockContainsMilitaryBase, isValid: true, isServiceable: true, state: "OH", zipCodeCtu: "01820" }); }); }); @@ -301,6 +301,24 @@ describe("service-location.vue", () => { // Assert expect(wrapper.vm.mobileLocationQuestions).toStrictEqual(newMobileLocationQuestions); }); + + test("displays military zip message when zip is updated", () => { + // Arrange + const { wrapper } = setupMocks({}); + wrapper.vm.$refs.mobileLocationModalQuestions.resetComponent = jest.fn(); + expect(wrapper.vm.zipContainsMilitaryBase).toBe(false); + + const newServiceZipCodeQuestion = { + zipCode: "45433", + state: "OH", + }; + + // Assert + wrapper.setData({zipCode: newServiceZipCodeQuestion.zipCode}); + wrapper.vm.$nextTick(() => { + expect(wrapper.vm.zipContainsMilitaryBase).toBe(true); + }); + }); }); describe("updating mobile location", () => {