Also route insurance-company to heritage for verified users + tests
This commit is contained in:
parent
830988a9a0
commit
5af18a36cf
2 changed files with 106 additions and 13 deletions
|
|
@ -32,12 +32,16 @@ export async function getDirectNavigation(toRoute) {
|
||||||
// Verified insurance users need to be routed around some pages
|
// Verified insurance users need to be routed around some pages
|
||||||
// vehicle -> vehicle-damage
|
// vehicle -> vehicle-damage
|
||||||
// quote -> heritage
|
// quote -> heritage
|
||||||
|
// insurance-company -> heritage
|
||||||
if (store.getters.payment.insuranceCoverage.isVerified) {
|
if (store.getters.payment.insuranceCoverage.isVerified) {
|
||||||
if (fmgPageValue === fmgPageValues.VEHICLE) {
|
if (fmgPageValue === fmgPageValues.VEHICLE) {
|
||||||
return fmgPageValues.VEHICLE_DAMAGE;
|
return fmgPageValues.VEHICLE_DAMAGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fmgPageValue === fmgPageValues.QUOTE) {
|
if (
|
||||||
|
fmgPageValue === fmgPageValues.QUOTE ||
|
||||||
|
fmgPageValue === fmgPageValues.INSURANCE_COMPANY
|
||||||
|
) {
|
||||||
return fmgPageValues.HERITAGE;
|
return fmgPageValues.HERITAGE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -359,21 +359,110 @@ describe("getPageToRouteExistingOrderTo", () => {
|
||||||
expect(result).toBe("testValue");
|
expect(result).toBe("testValue");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("For verified insurance users, replace navigation to `vehicle` with `vehicle-damage`", async () => {
|
describe("Verified users", () => {
|
||||||
// Arrange
|
test("Replace navigation to `vehicle` with `vehicle-damage`", async () => {
|
||||||
const toRoute = {
|
// Arrange
|
||||||
query: {
|
const toRoute = {
|
||||||
fmgPage: fmgPageValues.VEHICLE,
|
query: {
|
||||||
},
|
fmgPage: fmgPageValues.VEHICLE,
|
||||||
};
|
},
|
||||||
|
};
|
||||||
|
|
||||||
store.commit(storeMutations.UPDATE_IS_VERIFIED_INSURANCE, true);
|
store.commit(storeMutations.UPDATE_IS_VERIFIED_INSURANCE, true);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
const result = await getPageToRouteExistingOrderTo(toRoute);
|
const result = await getPageToRouteExistingOrderTo(toRoute);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
expect(result).toBe(fmgPageValues.VEHICLE_DAMAGE);
|
expect(result).toBe(fmgPageValues.VEHICLE_DAMAGE);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("Replace navigation to `quote` with `heritage`", async () => {
|
||||||
|
// Arrange
|
||||||
|
const toRoute = {
|
||||||
|
query: {
|
||||||
|
fmgPage: fmgPageValues.QUOTE,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
store.commit(storeMutations.UPDATE_IS_VERIFIED_INSURANCE, true);
|
||||||
|
|
||||||
|
// Act
|
||||||
|
const result = await getPageToRouteExistingOrderTo(toRoute);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(result).toBe(fmgPageValues.HERITAGE);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("Replace navigation to `insurance-company` with `heritage`", async () => {
|
||||||
|
// Arrange
|
||||||
|
const toRoute = {
|
||||||
|
query: {
|
||||||
|
fmgPage: fmgPageValues.INSURANCE_COMPANY,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
store.commit(storeMutations.UPDATE_IS_VERIFIED_INSURANCE, true);
|
||||||
|
|
||||||
|
// Act
|
||||||
|
const result = await getPageToRouteExistingOrderTo(toRoute);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(result).toBe(fmgPageValues.HERITAGE);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("Non-verified users", () => {
|
||||||
|
test("Don't replace navigation to `vehicle` with `vehicle-damage`", async () => {
|
||||||
|
// Arrange
|
||||||
|
const toRoute = {
|
||||||
|
query: {
|
||||||
|
fmgPage: fmgPageValues.VEHICLE,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
store.commit(storeMutations.UPDATE_IS_VERIFIED_INSURANCE, false);
|
||||||
|
|
||||||
|
// Act
|
||||||
|
const result = await getPageToRouteExistingOrderTo(toRoute);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(result).toBe(fmgPageValues.VEHICLE);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("Don't replace navigation to `quote` with `heritage`", async () => {
|
||||||
|
// Arrange
|
||||||
|
const toRoute = {
|
||||||
|
query: {
|
||||||
|
fmgPage: fmgPageValues.QUOTE,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
store.commit(storeMutations.UPDATE_IS_VERIFIED_INSURANCE, false);
|
||||||
|
|
||||||
|
// Act
|
||||||
|
const result = await getPageToRouteExistingOrderTo(toRoute);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(result).toBe(fmgPageValues.QUOTE);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("Don't replace navigation to `insurance-company` with `heritage`", async () => {
|
||||||
|
// Arrange
|
||||||
|
const toRoute = {
|
||||||
|
query: {
|
||||||
|
fmgPage: fmgPageValues.INSURANCE_COMPANY,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
store.commit(storeMutations.UPDATE_IS_VERIFIED_INSURANCE, false);
|
||||||
|
|
||||||
|
// Act
|
||||||
|
const result = await getPageToRouteExistingOrderTo(toRoute);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(result).toBe(fmgPageValues.INSURANCE_COMPANY);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue