Merge pull request #177 from Safelite/feature/Digital/SSR-231.01
SSR-231
This commit is contained in:
commit
6fb546fa94
3 changed files with 28 additions and 6 deletions
|
|
@ -43,6 +43,10 @@ const endpoints = {
|
||||||
url: "/parts/api/v1/parts/capability-questions",
|
url: "/parts/api/v1/parts/capability-questions",
|
||||||
method: "GET",
|
method: "GET",
|
||||||
},
|
},
|
||||||
|
GetPartFromCapabilityAnswer: {
|
||||||
|
url: "/parts/api/v1/parts/part-from-capability-answer",
|
||||||
|
method: "POST",
|
||||||
|
},
|
||||||
GetVehicle: {
|
GetVehicle: {
|
||||||
url: "/vehicle/api/v1/vehicle/lookup",
|
url: "/vehicle/api/v1/vehicle/lookup",
|
||||||
method: "GET",
|
method: "GET",
|
||||||
|
|
|
||||||
|
|
@ -259,7 +259,7 @@ describe("capabilityQuestions.vue", () => {
|
||||||
expect(wrapper.vm.saveCapabilityQuestionAnswers).toHaveBeenCalled;
|
expect(wrapper.vm.saveCapabilityQuestionAnswers).toHaveBeenCalled;
|
||||||
wrapper.unmount();
|
wrapper.unmount();
|
||||||
});
|
});
|
||||||
test("Should call GET_PARTS_OR_QUESTIONS API", async () => {
|
test("Should call GET_PART_FROM_CAPABILITY_QUESTION_ANSWER API", async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const { wrapper } = setupMocks({});
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
|
|
@ -279,13 +279,12 @@ describe("capabilityQuestions.vue", () => {
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
useMainStore().getPartsOrQuestions = jest.fn(() => {
|
wrapper.vm.dispatchStoreAction = jest.fn(() => {
|
||||||
return {
|
return {
|
||||||
data: {
|
data: [],
|
||||||
partsOrQuestions: [],
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
wrapper.vm.forwardButtonAction();
|
wrapper.vm.forwardButtonAction();
|
||||||
|
|
@ -293,7 +292,7 @@ describe("capabilityQuestions.vue", () => {
|
||||||
await nextTick();
|
await nextTick();
|
||||||
|
|
||||||
//Assert
|
//Assert
|
||||||
expect(wrapper.vm.getPartsOrQuestions).toHaveBeenCalled;
|
expect(wrapper.vm.getPartFromCapabilityQuestionAnswer).toHaveBeenCalled;
|
||||||
|
|
||||||
wrapper.unmount();
|
wrapper.unmount();
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -395,6 +395,25 @@ export const useMainStore = defineStore({
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getPartFromCapabilityQuestionAnswer(glassLocation) {
|
||||||
|
const pageData =this.pageData(issPageValues.CAPABILITY_QUESTIONS);
|
||||||
|
|
||||||
|
const part = pageData.partsOrQuestions.find((x) => x.glassLocation === glassLocation)
|
||||||
|
.parts[0];
|
||||||
|
const capabilityQuestionAnswers = this.order.damage.capabilityQuestionAnswers;
|
||||||
|
const capabilityQuestionAnswersForPart = capabilityQuestionAnswers.find(
|
||||||
|
(x) => x.glassLocation === glassLocation
|
||||||
|
);
|
||||||
|
|
||||||
|
return globalMethods.callHttpClient({
|
||||||
|
method: endpoints.GetPartFromCapabilityAnswer.method,
|
||||||
|
endpoint: endpoints.GetPartFromCapabilityAnswer.url,
|
||||||
|
payload: {
|
||||||
|
part,
|
||||||
|
capabilityAnswerResults: capabilityQuestionAnswersForPart,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
},
|
||||||
lookupVehicleByVin(vin) {
|
lookupVehicleByVin(vin) {
|
||||||
return globalMethods.callHttpClient({
|
return globalMethods.callHttpClient({
|
||||||
method: endpoints.LookupVehicleByVin.method,
|
method: endpoints.LookupVehicleByVin.method,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue