Merge pull request #514 from Safelite/feature/SSR-1022

fix for navigation to endorsements page
This commit is contained in:
katiekroell 2023-11-30 11:22:30 -05:00 committed by GitHub
commit aa3ed21dc8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 55 additions and 4 deletions

View file

@ -183,7 +183,7 @@ export default {
<style lang="scss" scoped>
:deep .subheader-primary {
margin-bottom: map-get($spacers, 3);
margin-bottom: map-get($spacers, 2);
}
:deep .subheader-secondary {

View file

@ -140,13 +140,62 @@ describe('policy-vehicles.vue', () => {
test(
// eslint-disable-next-line max-len
'Selected VIN matches vehicle listed in system and policy vehicle has endorsements => update vehicle and navigate forward with CLICKED_FORWARD_WITH_ENDORSEMENTS scenario.',
'Selected VIN matches vehicle listed in system and policy vehicle has Educator endorsement => update vehicle and navigate forward with CLICKED_FORWARD_WITH_ENDORSEMENTS scenario.',
async () => {
// Arrange
const { wrapper } = setupMocks({});
const vin = getRandomString(17, 17);
const endorsements = [getRandomString(10, 20)];
const endorsements = ['Educator'];
await wrapper.setData({
selectedVehicleVin: vin,
policyVehicles: [
{
vin,
endorsements
}
]
});
const year = getRandomInt(1998, 2023);
const lookupVehicleResponse = {
data: {
year
}
};
const store = useMainStore();
store.lookupVehicleByVin.mockReturnValue(Promise.resolve(lookupVehicleResponse));
const expectedInput = {
year,
vin,
noCoverage: true,
deductible: 0,
repairWaived: false,
endorsements
};
// Act
await wrapper.vm.forwardButtonAction();
// Assert
expect(store.updateVehicle).toHaveBeenCalledWith(expectedInput);
expect(wrapper.vm.$router.navigate).toHaveBeenCalledWith(
navigationScenarios.CLICKED_FORWARD_WITH_ENDORSEMENTS,
undefined
);
}
);
test(
// eslint-disable-next-line max-len
'Selected VIN matches vehicle listed in system and policy vehicle has Parking Guard endorsement => update vehicle and navigate forward with CLICKED_FORWARD_WITH_ENDORSEMENTS scenario.',
async () => {
// Arrange
const { wrapper } = setupMocks({});
const vin = getRandomString(17, 17);
const endorsements = ['Parking Guard'];
await wrapper.setData({
selectedVehicleVin: vin,
policyVehicles: [

View file

@ -231,7 +231,9 @@ export default {
{},
{}
);
} else if (this.endorsementsForSelectedVehicle?.length > 0) {
} else if (this.endorsementsForSelectedVehicle?.length > 0
&& (this.endorsementsForSelectedVehicle?.includes(endorsementOptions.PARKING_GUARD)
|| this.endorsementsForSelectedVehicle?.includes(endorsementOptions.EDUCATOR))) {
this.$router.navigate(
this.navigationScenarios.CLICKED_FORWARD_WITH_ENDORSEMENTS,
this.$route