remove logic for verifying policy zip

This commit is contained in:
Katie Kroell 2023-05-16 09:25:14 -04:00
parent c5984c5244
commit b8a72d7f41
2 changed files with 6 additions and 39 deletions

View file

@ -76,7 +76,6 @@ describe("navigation", () => {
await wrapper.setData({
isCoverageEnabled: true,
zipCodeMatch: true,
});
useMainStore().order.policy.policyNumber = "p_0001";
@ -105,7 +104,6 @@ describe("navigation", () => {
isCoverageEnabled: true,
vehiclesCount: 0,
vehiclesFound: null,
zipCodeMatch: true,
});
useMainStore().order.policy.policyNumber = "p_0001";
@ -145,31 +143,6 @@ describe("navigation", () => {
undefined
);
});
test("if zip code entered does not match zip on policy, navigate to policy-holder-details page", async () => {
// Arrange
const { wrapper } = setupMocks({
policies: [{}]
});
await wrapper.setData({
isCoverageEnabled: true,
zipCodeMatch: false,
});
useMainStore().order.policy.policyNumber = "p_0001";
useMainStore().order.policy.dateOfLoss = "2022-01-28";
useMainStore().order.accountNumber = "00000";
// Act
await wrapper.vm.navigateForward();
// Assert
expect(wrapper.vm.$router.navigate).toHaveBeenCalledWith(
navigationScenarios.CLICKED_FORWARD_POLICY_UNVERIFIED,
undefined
);
});
});
function setupMocks({

View file

@ -205,7 +205,6 @@ export default {
return {
welcomePageModel: this.getWelcomePageModelFromStore(),
vehiclesFound: [],
zipCodeMatch: false,
};
},
setup() {
@ -266,12 +265,7 @@ export default {
}
const policy = policyInfo.policies?.[0];
// get the first 5 digits of the policy zip code
const policyZip = (policy?.insureds?.[0]?.zipCode)?.slice(0, 5);
// check if policy zip enters matches zip on policy
this.zipCodeMatch = policyZip == this.welcomePageModel.policyZipCode;
if (policy && this.zipCodeMatch) {
if (policy) {
//populate policy holder details from policy lookup
this.mainStore.order.customer.address.streetAddress = policy.insureds?.[0]?.address;
this.mainStore.order.customer.address.city = policy.insureds?.[0]?.city;
@ -283,14 +277,14 @@ export default {
//populate vehicles
this.vehiclesFound = policy.vehicles;
}
return this.navigateForward(policy, this.zipCodeMatch);
return this.navigateForward(policy);
}
return this.navigateForward();
},
navigateForward(policy, zipCodeMatch) {
navigateForward(policy) {
// if policy lookup is unsuccessful, navigate to policy-holder-details page
if (!policy || !zipCodeMatch) {
if (!policy) {
this.$router.navigate(
this.navigationScenarios.CLICKED_FORWARD_POLICY_UNVERIFIED,
this.$route
@ -298,14 +292,14 @@ export default {
}
// if policy lookup is successful, but no vehicles are associated with the policy
// navigate to vehicle-selection page (manual entry)
else if (policy && zipCodeMatch && !this.vehiclesFound) {
else if (policy && !this.vehiclesFound) {
this.$router.navigate(
this.navigationScenarios.CLICKED_FORWARD_POLICY_VERIFIED_NO_VEHICLES,
this.$route
);
}
// if policy lookup is successful and vehicles are found, navigate to policy-vehicles page
else if (policy && zipCodeMatch && this.vehiclesFound) {
else if (policy && this.vehiclesFound) {
this.$router.navigate(
this.navigationScenarios.CLICKED_FORWARD_POLICY_VERIFIED_WITH_VEHICLES,
this.$route,