SSR-1431 Update Unit Tests
This commit is contained in:
parent
29bf33bdc7
commit
7594056c94
1 changed files with 46 additions and 1 deletions
|
|
@ -24,7 +24,17 @@ const lookupVehicleByVin = {
|
||||||
methodName: 'lookupVehicleByVin',
|
methodName: 'lookupVehicleByVin',
|
||||||
mockResponse: {
|
mockResponse: {
|
||||||
data: {
|
data: {
|
||||||
carId: mockCarId
|
carId: mockCarId,
|
||||||
|
canSafeliteService: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const lookupVehicleByVinCannotService = {
|
||||||
|
methodName: 'lookupVehicleByVin',
|
||||||
|
mockResponse: {
|
||||||
|
data: {
|
||||||
|
carId: mockCarId,
|
||||||
|
canSafeliteService: false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -484,6 +494,41 @@ describe('vin-lookup.vue', () => {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
test('Bailout if entered vin cannot be serviced', async () => {
|
||||||
|
const user = userEvent.setup();
|
||||||
|
mountOptions.global.stubs.vinQuestion = false;
|
||||||
|
|
||||||
|
mountOptions.data = () => ({
|
||||||
|
vinWithNonMatchingCarId: false,
|
||||||
|
isCarIdDifferentFromTheStore: false,
|
||||||
|
vin: mockValidVin
|
||||||
|
});
|
||||||
|
|
||||||
|
getPartsOrQuestions.mockResponse = vehicleWithNoAdditionalPartsOrQuestionsMockResponse;
|
||||||
|
|
||||||
|
jest.spyOn(VinLookupComponent.methods, lookupVehicleByVin.methodName)
|
||||||
|
.mockResolvedValue(lookupVehicleByVinCannotService.mockResponse);
|
||||||
|
jest.spyOn(vehicleQuestionsMixin.methods, getPartsOrQuestions.methodName)
|
||||||
|
.mockResolvedValue(getPartsOrQuestions.mockResponse);
|
||||||
|
|
||||||
|
const { container } = render(VinLookupComponent, mountOptions);
|
||||||
|
|
||||||
|
const vinInput = container.querySelector(vinInputSelector);
|
||||||
|
await user.type(vinInput, mockValidVin);
|
||||||
|
|
||||||
|
const continueButton = container.querySelector(continueButtonQuerySelector);
|
||||||
|
await user.click(continueButton);
|
||||||
|
|
||||||
|
await flushPromises();
|
||||||
|
await waitFor(() => {
|
||||||
|
expect(mockRouter.navigate).toHaveBeenCalledTimes(1);
|
||||||
|
expect(mockRouter.navigate)
|
||||||
|
.toHaveBeenCalledWith(
|
||||||
|
navigationScenarios.CLICKED_FORWARD_WITH_BAILOUT,
|
||||||
|
mockRoute
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
// eslint-disable-next-line max-len
|
// eslint-disable-next-line max-len
|
||||||
test('Policy Vehicle with invalid vin corrected. Click "Continue", execute navigate with navigationScenario.CORRECTED_VIN_FROM_POLICY_VEHICLE', async () => {
|
test('Policy Vehicle with invalid vin corrected. Click "Continue", execute navigate with navigationScenario.CORRECTED_VIN_FROM_POLICY_VEHICLE', async () => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue