Misc Questions Pages
This commit is contained in:
parent
fed47a13e9
commit
b7f2f060ab
6 changed files with 75 additions and 13 deletions
|
|
@ -237,6 +237,11 @@ describe("capabilityQuestions.vue", () => {
|
||||||
data: [],
|
data: [],
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
wrapper.vm.dispatchStoreActionWithLogging = jest.fn(() => {
|
||||||
|
return {
|
||||||
|
data: [],
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
wrapper.vm.forwardButtonAction();
|
wrapper.vm.forwardButtonAction();
|
||||||
|
|
@ -272,6 +277,11 @@ describe("capabilityQuestions.vue", () => {
|
||||||
data: [],
|
data: [],
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
wrapper.vm.dispatchStoreActionWithLogging = jest.fn(() => {
|
||||||
|
return {
|
||||||
|
data: [],
|
||||||
|
};
|
||||||
|
});
|
||||||
const spy = jest.spyOn(wrapper.vm, "dispatchStoreAction");
|
const spy = jest.spyOn(wrapper.vm, "dispatchStoreAction");
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
|
|
@ -325,7 +335,12 @@ describe("capabilityQuestions.vue", () => {
|
||||||
data: [],
|
data: [],
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
const spy = jest.spyOn(wrapper.vm, "dispatchStoreAction");
|
wrapper.vm.dispatchStoreActionWithLogging = jest.fn(() => {
|
||||||
|
return {
|
||||||
|
data: [],
|
||||||
|
};
|
||||||
|
});
|
||||||
|
const spy = jest.spyOn(wrapper.vm, "dispatchStoreActionWithLogging");
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
wrapper.vm.forwardButtonAction();
|
wrapper.vm.forwardButtonAction();
|
||||||
|
|
@ -334,9 +349,10 @@ describe("capabilityQuestions.vue", () => {
|
||||||
|
|
||||||
//Assert
|
//Assert
|
||||||
expect(spy).toHaveBeenNthCalledWith(
|
expect(spy).toHaveBeenNthCalledWith(
|
||||||
2,
|
1,
|
||||||
"getPartFromCapabilityQuestionAnswer",
|
"getPartFromCapabilityQuestionAnswer",
|
||||||
"Windshield",
|
"Windshield",
|
||||||
|
"capability-questions",
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -368,6 +384,11 @@ describe("capabilityQuestions.vue", () => {
|
||||||
data: [],
|
data: [],
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
wrapper.vm.dispatchStoreActionWithLogging = jest.fn(() => {
|
||||||
|
return {
|
||||||
|
data: [],
|
||||||
|
};
|
||||||
|
});
|
||||||
wrapper.vm.navigateForward = jest.fn();
|
wrapper.vm.navigateForward = jest.fn();
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
|
|
|
||||||
|
|
@ -162,9 +162,10 @@ export default {
|
||||||
const partsOrQuestions = this.partsOrQuestionsData;
|
const partsOrQuestions = this.partsOrQuestionsData;
|
||||||
for (let answer of questionAnswersArray) {
|
for (let answer of questionAnswersArray) {
|
||||||
const partFromCapabilityQuestionAnswer = (
|
const partFromCapabilityQuestionAnswer = (
|
||||||
await this.dispatchStoreAction(
|
await this.dispatchStoreActionWithLogging(
|
||||||
this.storeActions.GET_PART_FROM_CAPABILITY_QUESTION_ANSWER,
|
this.storeActions.GET_PART_FROM_CAPABILITY_QUESTION_ANSWER,
|
||||||
answer.glassLocation,
|
answer.glassLocation,
|
||||||
|
"capability-questions",
|
||||||
false
|
false
|
||||||
)
|
)
|
||||||
).data;
|
).data;
|
||||||
|
|
|
||||||
|
|
@ -248,6 +248,13 @@ describe("partQuestions.vue...", () => {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
wrapper.vm.dispatchStoreActionWithLogging = jest.fn(() => {
|
||||||
|
return {
|
||||||
|
data: {
|
||||||
|
glassPieceParts: [],
|
||||||
|
},
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
wrapper.vm.forwardButtonAction();
|
wrapper.vm.forwardButtonAction();
|
||||||
|
|
@ -281,6 +288,13 @@ describe("partQuestions.vue...", () => {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
wrapper.vm.dispatchStoreActionWithLogging = jest.fn(() => {
|
||||||
|
return {
|
||||||
|
data: {
|
||||||
|
glassPieceParts: [],
|
||||||
|
},
|
||||||
|
};
|
||||||
|
});
|
||||||
const spy = jest.spyOn(wrapper.vm, "dispatchStoreAction");
|
const spy = jest.spyOn(wrapper.vm, "dispatchStoreAction");
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
|
|
@ -328,7 +342,14 @@ describe("partQuestions.vue...", () => {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
const spy = jest.spyOn(wrapper.vm, "dispatchStoreAction");
|
wrapper.vm.dispatchStoreActionWithLogging = jest.fn(() => {
|
||||||
|
return {
|
||||||
|
data: {
|
||||||
|
glassPieceParts: [],
|
||||||
|
},
|
||||||
|
};
|
||||||
|
});
|
||||||
|
const spy = jest.spyOn(wrapper.vm, "dispatchStoreActionWithLogging");
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
wrapper.vm.forwardButtonAction();
|
wrapper.vm.forwardButtonAction();
|
||||||
|
|
@ -336,7 +357,7 @@ describe("partQuestions.vue...", () => {
|
||||||
await nextTick();
|
await nextTick();
|
||||||
|
|
||||||
//Assert
|
//Assert
|
||||||
expect(spy).toHaveBeenNthCalledWith(2, "getParts");
|
expect(spy).toHaveBeenNthCalledWith(1, "getParts", null, "part-questions");
|
||||||
|
|
||||||
wrapper.unmount();
|
wrapper.unmount();
|
||||||
});
|
});
|
||||||
|
|
@ -362,6 +383,13 @@ describe("partQuestions.vue...", () => {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
wrapper.vm.dispatchStoreActionWithLogging = jest.fn(() => {
|
||||||
|
return {
|
||||||
|
data: {
|
||||||
|
glassPieceParts: [],
|
||||||
|
},
|
||||||
|
};
|
||||||
|
});
|
||||||
wrapper.vm.navigateForward = jest.fn();
|
wrapper.vm.navigateForward = jest.fn();
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
|
|
|
||||||
|
|
@ -145,7 +145,11 @@ export default {
|
||||||
);
|
);
|
||||||
|
|
||||||
// call API parts method
|
// call API parts method
|
||||||
const partsLookup = await this.dispatchStoreAction(this.storeActions.GET_PARTS);
|
const partsLookup = await this.dispatchStoreActionWithLogging(
|
||||||
|
this.storeActions.GET_PARTS,
|
||||||
|
null,
|
||||||
|
"part-questions"
|
||||||
|
);
|
||||||
|
|
||||||
const glassPartsForStore = partsLookup.data.glassPieceParts;
|
const glassPartsForStore = partsLookup.data.glassPieceParts;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -408,12 +408,13 @@ export default {
|
||||||
for (let partOrQuestion of partsOrQuestions) {
|
for (let partOrQuestion of partsOrQuestions) {
|
||||||
if (this.hasCapabilityQuestions([partOrQuestion])) {
|
if (this.hasCapabilityQuestions([partOrQuestion])) {
|
||||||
let capabilityQuestionsForGlassLocation = (
|
let capabilityQuestionsForGlassLocation = (
|
||||||
await baseMixin.methods.dispatchStoreAction(
|
await baseMixin.methods.dispatchStoreActionWithLogging(
|
||||||
storeActions.GET_CAPABILITY_QUESTIONS,
|
storeActions.GET_CAPABILITY_QUESTIONS,
|
||||||
{
|
{
|
||||||
carId: store.getters.vehicle.carId,
|
carId: store.getters.vehicle.carId,
|
||||||
partNumber: partOrQuestion.parts[0].partNumber,
|
partNumber: partOrQuestion.parts[0].partNumber,
|
||||||
}
|
},
|
||||||
|
currentPage
|
||||||
)
|
)
|
||||||
).data;
|
).data;
|
||||||
|
|
||||||
|
|
@ -449,13 +450,13 @@ export default {
|
||||||
if (store.getters.order.referralNumber?.length === 6) {
|
if (store.getters.order.referralNumber?.length === 6) {
|
||||||
navigateToHeritageFunnel({
|
navigateToHeritageFunnel({
|
||||||
shouldSaveSession: true,
|
shouldSaveSession: true,
|
||||||
pageNameToLog: this.$options.name,
|
pageNameToLog: currentPage,
|
||||||
loadingModal: self.$refs.loadingModal,
|
loadingModal: self.$refs.loadingModal,
|
||||||
});
|
});
|
||||||
} else if (payment.isInsurance && payment.insuranceCoverage.isVerified) {
|
} else if (payment.isInsurance && payment.insuranceCoverage.isVerified) {
|
||||||
navigateToHeritageFunnel({
|
navigateToHeritageFunnel({
|
||||||
shouldSaveSession: true,
|
shouldSaveSession: true,
|
||||||
pageNameToLog: this.$options.name,
|
pageNameToLog: currentPage,
|
||||||
loadingModal: self.$refs.loadingModal,
|
loadingModal: self.$refs.loadingModal,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -1171,7 +1171,7 @@ export const actions = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// Parts API Actions
|
// Parts API Actions
|
||||||
async getParts(context) {
|
async getParts(context, { pageNameToLog }) {
|
||||||
const vehicle = context.getters.vehicle;
|
const vehicle = context.getters.vehicle;
|
||||||
const damage = context.getters.damage;
|
const damage = context.getters.damage;
|
||||||
const order = context.state.order;
|
const order = context.state.order;
|
||||||
|
|
@ -1196,6 +1196,8 @@ export const actions = {
|
||||||
zip: zipCode,
|
zip: zipCode,
|
||||||
vin: vin,
|
vin: vin,
|
||||||
},
|
},
|
||||||
|
logApiCall: true,
|
||||||
|
pageNameToLog: pageNameToLog,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Flatten location and name properties
|
// Flatten location and name properties
|
||||||
|
|
@ -1296,14 +1298,17 @@ export const actions = {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
getCapabilityQuestions(context, { carId, partNumber }) {
|
getCapabilityQuestions(context, { payload: { carId, partNumber }, pageNameToLog }) {
|
||||||
return globalMethods.callHttpClient({
|
return globalMethods.callHttpClient({
|
||||||
method: endpoints.GetCapabilityQuestions.method,
|
method: endpoints.GetCapabilityQuestions.method,
|
||||||
endpoint: `${endpoints.GetCapabilityQuestions.url}/${carId}/${partNumber}`,
|
endpoint: `${endpoints.GetCapabilityQuestions.url}/${carId}/${partNumber}`,
|
||||||
|
logApiCall: true,
|
||||||
|
pageNameToLog: pageNameToLog,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
getPartFromCapabilityQuestionAnswer(context, glassLocation) {
|
getPartFromCapabilityQuestionAnswer(context, { payload, pageNameToLog }) {
|
||||||
|
const glassLocation = payload;
|
||||||
const pageData = context.getters.pageData(fmgPageValues.CAPABILITY_QUESTIONS);
|
const pageData = context.getters.pageData(fmgPageValues.CAPABILITY_QUESTIONS);
|
||||||
|
|
||||||
const part = pageData.partsOrQuestions.find((x) => x.glassLocation === glassLocation)
|
const part = pageData.partsOrQuestions.find((x) => x.glassLocation === glassLocation)
|
||||||
|
|
@ -1320,6 +1325,8 @@ export const actions = {
|
||||||
part,
|
part,
|
||||||
capabilityAnswerResults: capabilityQuestionAnswersForPart,
|
capabilityAnswerResults: capabilityQuestionAnswersForPart,
|
||||||
},
|
},
|
||||||
|
logApiCall: true,
|
||||||
|
pageNameToLog: pageNameToLog,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue