updated test

This commit is contained in:
Bill Richardson 2023-03-13 10:45:59 -04:00
parent aa25092cc9
commit 757bb36cea

View file

@ -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", () => {