final updates to welcome-page navigation

This commit is contained in:
Katie Kroell 2023-05-15 15:58:46 -04:00
parent bac3c17dae
commit c09f09543f
4 changed files with 24 additions and 20 deletions

View file

@ -88,7 +88,7 @@ describe("navigation", () => {
// Assert // Assert
expect(wrapper.vm.$router.navigate).toHaveBeenCalledWith( expect(wrapper.vm.$router.navigate).toHaveBeenCalledWith(
navigationScenarios.CLICKED_FORWARD_WITH_POLICY_AND_VEHICLES, navigationScenarios.CLICKED_FORWARD_POLICY_VERIFIED_WITH_VEHICLES,
undefined, undefined,
{}, {},
{}, {},
@ -118,7 +118,7 @@ describe("navigation", () => {
// Assert // Assert
expect(wrapper.vm.$router.navigate).toHaveBeenCalledWith( expect(wrapper.vm.$router.navigate).toHaveBeenCalledWith(
navigationScenarios.CLICKED_FORWARD_WITH_POLICY_AND_NO_VEHICLES, navigationScenarios.CLICKED_FORWARD_POLICY_VERIFIED_NO_VEHICLES,
undefined undefined
); );
}); });
@ -141,7 +141,7 @@ describe("navigation", () => {
// Assert // Assert
expect(wrapper.vm.$router.navigate).toHaveBeenCalledWith( expect(wrapper.vm.$router.navigate).toHaveBeenCalledWith(
navigationScenarios.CLICKED_FORWARD_WITH_NO_POLICY, navigationScenarios.CLICKED_FORWARD_POLICY_UNVERIFIED,
undefined undefined
); );
}); });
@ -165,7 +165,7 @@ describe("navigation", () => {
// Assert // Assert
expect(wrapper.vm.$router.navigate).toHaveBeenCalledWith( expect(wrapper.vm.$router.navigate).toHaveBeenCalledWith(
navigationScenarios.CLICKED_FORWARD_WITH_NO_POLICY, navigationScenarios.CLICKED_FORWARD_POLICY_UNVERIFIED,
undefined undefined
); );
}); });

View file

@ -260,14 +260,14 @@ export default {
const policyLookupResultMap = await settleAllPromises(promisePolicyLookupResultMap); const policyLookupResultMap = await settleAllPromises(promisePolicyLookupResultMap);
const policyInfo = policyLookupResultMap.policyLookupResponse; const policyInfo = policyLookupResultMap.policyLookupResponse;
// if policy lookup fails, navigate to policy-holder-details page // if policy lookup fails, navigate directly to policy-holder-details page
if (!policyInfo) { if (!policyInfo) {
this.navigateForward(); this.navigateForward();
} }
const policy = policyInfo.policies?.[0]; const policy = policyInfo.policies?.[0];
// get the first 5 digits of the policy zip code // get the first 5 digits of the policy zip code
const policyZip = (policy.insureds?.[0]?.zipCode).slice(0, 5); const policyZip = (policy?.insureds?.[0]?.zipCode)?.slice(0, 5);
// check if policy zip enters matches zip on policy // check if policy zip enters matches zip on policy
this.zipCodeMatch = policyZip == this.welcomePageModel.policyZipCode; this.zipCodeMatch = policyZip == this.welcomePageModel.policyZipCode;
@ -292,7 +292,7 @@ export default {
// if policy lookup is unsuccessful, navigate to policy-holder-details page // if policy lookup is unsuccessful, navigate to policy-holder-details page
if (!policy || !zipCodeMatch) { if (!policy || !zipCodeMatch) {
this.$router.navigate( this.$router.navigate(
this.navigationScenarios.CLICKED_FORWARD_WITH_NO_POLICY, this.navigationScenarios.CLICKED_FORWARD_POLICY_UNVERIFIED,
this.$route this.$route
); );
} }
@ -300,14 +300,14 @@ export default {
// navigate to vehicle-selection page (manual entry) // navigate to vehicle-selection page (manual entry)
else if (policy && zipCodeMatch && !this.vehiclesFound) { else if (policy && zipCodeMatch && !this.vehiclesFound) {
this.$router.navigate( this.$router.navigate(
this.navigationScenarios.CLICKED_FORWARD_WITH_POLICY_AND_NO_VEHICLES, this.navigationScenarios.CLICKED_FORWARD_POLICY_VERIFIED_NO_VEHICLES,
this.$route this.$route
); );
} }
// if policy lookup is successful and vehicles are found, navigate to policy-vehicles page // if policy lookup is successful and vehicles are found, navigate to policy-vehicles page
else if (policy && zipCodeMatch && this.vehiclesFound) { else if (policy && zipCodeMatch && this.vehiclesFound) {
this.$router.navigate( this.$router.navigate(
this.navigationScenarios.CLICKED_FORWARD_WITH_POLICY_AND_VEHICLES, this.navigationScenarios.CLICKED_FORWARD_POLICY_VERIFIED_WITH_VEHICLES,
this.$route, this.$route,
{}, {},
{}, {},

View file

@ -7,9 +7,9 @@ const navigationScenarios = {
MOVE_FORWARD_ENTRY_PAGE: "MOVE_FORWARD_ENTRY_PAGE", MOVE_FORWARD_ENTRY_PAGE: "MOVE_FORWARD_ENTRY_PAGE",
// Welcome // Welcome
CLICKED_FORWARD_WITH_POLICY_AND_VEHICLES: "CLICKED_FORWARD_WITH_POLICY_AND_VEHICLES", CLICKED_FORWARD_POLICY_UNVERIFIED: "CLICKED_FORWARD_POLICY_UNVERIFIED",
CLICKED_FORWARD_WITH_NO_POLICY: "CLICKED_FORWARD_WITH_NO_POLICY", CLICKED_FORWARD_POLICY_VERIFIED_NO_VEHICLES: "CLICKED_FORWARD_POLICY_VERIFIED_NO_VEHICLES",
CLICKED_FORWARD_WITH_POLICY_AND_NO_VEHICLES: "CLICKED_FORWARD_WITH_POLICY_AND_NO_VEHICLES", CLICKED_FORWARD_POLICY_VERIFIED_WITH_VEHICLES: "CLICKED_FORWARD_POLICY_VERIFIED_WITH_VEHICLES",
// YMMS // YMMS
SELECTED_YEAR: "SELECTED_YEAR", SELECTED_YEAR: "SELECTED_YEAR",

View file

@ -392,16 +392,20 @@ const routingTable = function(store) {
destinationIssPageValue: issPageValues.WELCOME_PAGE destinationIssPageValue: issPageValues.WELCOME_PAGE
}, },
{ {
scenario: navigationScenarios.CLICKED_FORWARD_WITH_POLICY_AND_VEHICLES, scenario: navigationScenarios.CLICKED_FORWARD,
destinationIssPageValue: issPageValues.POLICY_VEHICLES
},
{
scenario: navigationScenarios.CLICKED_FORWARD_WITH_NO_POLICY,
destinationIssPageValue: issPageValues.POLICY_HOLDER_DETAILS destinationIssPageValue: issPageValues.POLICY_HOLDER_DETAILS
}, },
{ {
scenario: navigationScenarios.CLICKED_FORWARD_WITH_POLICY_AND_NO_VEHICLES, scenario: navigationScenarios.CLICKED_FORWARD_POLICY_UNVERIFIED,
destinationIssPageValue: issPageValues.POLICY_HOLDER_DETAILS
},
{
scenario: navigationScenarios.CLICKED_FORWARD_POLICY_VERIFIED_NO_VEHICLES,
destinationIssPageValue: issPageValues.VEHICLE_SELECTION destinationIssPageValue: issPageValues.VEHICLE_SELECTION
},
{
scenario: navigationScenarios.CLICKED_FORWARD_POLICY_VERIFIED_WITH_VEHICLES,
destinationIssPageValue: issPageValues.POLICY_VEHICLES
} }
] ]
}, },
@ -414,12 +418,12 @@ const routingTable = function(store) {
}, },
{ {
scenario: navigationScenarios.CLICKED_FORWARD_POLICY_UNVERIFIED, scenario: navigationScenarios.CLICKED_FORWARD_POLICY_UNVERIFIED,
destinationIssPageValue: issPageValues.VEHICLE_YEAR destinationIssPageValue: issPageValues.VEHICLE_SELECTION
}, },
{ {
scenario: navigationScenarios.CLICKED_FORWARD_POLICY_VERIFIED, scenario: navigationScenarios.CLICKED_FORWARD_POLICY_VERIFIED,
destinationIssPageValue: issPageValues.POLICY_VEHICLES destinationIssPageValue: issPageValues.POLICY_VEHICLES
} },
] ]
}, },
{ {