completed unit test
This commit is contained in:
parent
647c47c86a
commit
ee08bed3ea
2 changed files with 15 additions and 13 deletions
|
|
@ -122,14 +122,7 @@ const vehicleWithNoAdditionalPartsOrQuestionsMockResponse = {
|
|||
};
|
||||
|
||||
const partsOrQuestionsErrorMockResponse = {
|
||||
data: {
|
||||
partsOrQuestions: [
|
||||
{
|
||||
parts: null
|
||||
}
|
||||
],
|
||||
partQuestions: null
|
||||
}
|
||||
error: 'Error getting parts'
|
||||
};
|
||||
|
||||
jest.mock('bootstrap', () => ({
|
||||
|
|
@ -533,6 +526,14 @@ describe('vin-lookup.vue', () => {
|
|||
async () => {
|
||||
const user = userEvent.setup();
|
||||
mountOptions.global.stubs.vinQuestion = false;
|
||||
|
||||
mountOptions.data = () => ({
|
||||
vinWithNonMatchingCarId: false,
|
||||
isCarIdDifferentFromTheStore: false,
|
||||
vin: mockValidVin,
|
||||
hasBailedOut: true
|
||||
});
|
||||
|
||||
getPartsOrQuestions.mockResponse = partsOrQuestionsErrorMockResponse;
|
||||
|
||||
jest.spyOn(VinLookupComponent.methods, lookupVehicleByVin.methodName)
|
||||
|
|
|
|||
|
|
@ -151,6 +151,9 @@ export default {
|
|||
carIdIsValid() {
|
||||
return this.hasValidCarId();
|
||||
},
|
||||
hasBailedOut() {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
vin() {
|
||||
|
|
@ -274,14 +277,12 @@ export default {
|
|||
return null;
|
||||
}
|
||||
|
||||
let hasBailedOut = false;
|
||||
const partsOrQuestionsResponse = await this.getPartsOrQuestions();
|
||||
if (partsOrQuestionsResponse.error) {
|
||||
this.mainStore.setBailout(
|
||||
bailoutMessage.NoPartsAvailable(partsOrQuestionsResponse.error.data));
|
||||
this.mainStore.setBailout(bailoutMessage.NoPartsAvailable(partsOrQuestionsResponse.error.data));
|
||||
window.console.error('Error on retrieving PartsOrQuestions');
|
||||
this.$refs.siteFooter.removeLoader();
|
||||
hasBailedOut = true;
|
||||
this.hasBailedOut = true;
|
||||
this.$router.navigate(
|
||||
this.navigationScenarios.CLICKED_FORWARD_WITH_BAILOUT,
|
||||
this.$route
|
||||
|
|
@ -289,7 +290,7 @@ export default {
|
|||
}
|
||||
|
||||
// Comes from vehicleQuestionsMixin.navigateForward()
|
||||
if (!hasBailedOut) {
|
||||
if (!this.hasBailedOut) {
|
||||
await this.navigateForward(
|
||||
partsOrQuestionsResponse.data.partsOrQuestions,
|
||||
this
|
||||
|
|
|
|||
Loading…
Reference in a new issue