unit test for nav scenario
This commit is contained in:
parent
d57c9dba2e
commit
54c760830f
1 changed files with 53 additions and 1 deletions
|
|
@ -117,7 +117,8 @@ describe('policy-vehicles.vue', () => {
|
||||||
vin,
|
vin,
|
||||||
noCoverage: true,
|
noCoverage: true,
|
||||||
deductible: 0,
|
deductible: 0,
|
||||||
repairWaived: false
|
repairWaived: false,
|
||||||
|
endorsements: []
|
||||||
};
|
};
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
|
|
@ -135,6 +136,57 @@ 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.',
|
||||||
|
async () => {
|
||||||
|
// Arrange
|
||||||
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
|
const vin = getRandomString(17, 17);
|
||||||
|
const endorsements = [getRandomString(10, 20)];
|
||||||
|
await wrapper.setData({
|
||||||
|
selectedVehicleVin: vin,
|
||||||
|
policyVehicles: [
|
||||||
|
{
|
||||||
|
vin,
|
||||||
|
endorsements
|
||||||
|
}
|
||||||
|
],
|
||||||
|
bailout: false
|
||||||
|
});
|
||||||
|
|
||||||
|
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(wrapper.vm.bailout).toBeFalsy();
|
||||||
|
expect(store.updateVehicle).toHaveBeenCalledWith(expectedInput);
|
||||||
|
expect(wrapper.vm.$router.navigate).toHaveBeenCalledWith(
|
||||||
|
navigationScenarios.CLICKED_FORWARD_WITH_ENDORSEMENTS,
|
||||||
|
undefined
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
test(
|
test(
|
||||||
'Error in lookupVehicleByVin call => bailout true and navigate forward with CLICKED_FORWARD_WITH_BAILOUT scenario.',
|
'Error in lookupVehicleByVin call => bailout true and navigate forward with CLICKED_FORWARD_WITH_BAILOUT scenario.',
|
||||||
async () => {
|
async () => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue