Merge pull request #514 from Safelite/feature/SSR-1022
fix for navigation to endorsements page
This commit is contained in:
commit
aa3ed21dc8
3 changed files with 55 additions and 4 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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: [
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue