add/update tests for navigation

This commit is contained in:
Katie Kroell 2023-11-30 11:12:59 -05:00
parent 56ae1c3d26
commit 48f704f6ea

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: [