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