Add tests
This commit is contained in:
parent
ffebba8652
commit
24e4441eaf
8 changed files with 847 additions and 104 deletions
|
|
@ -236,7 +236,7 @@ describe("vehicle-parts.vue", () => {
|
||||||
wrapper.vm.backButtonAction();
|
wrapper.vm.backButtonAction();
|
||||||
|
|
||||||
//Assert
|
//Assert
|
||||||
expect(wrapper.vm.$router.navigateWithoutSaving).toHaveBeenCalledWith(navigationScenarios.CLICKED_BACK_TO_GO_TO_PART_QUESTIONS, wrapper.vm.$route);
|
expect(wrapper.vm.$router.navigateWithoutSaving).toHaveBeenCalledWith(navigationScenarios.CLICKED_BACK_WITH_PART_QUESTIONS, wrapper.vm.$route);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -277,7 +277,7 @@ describe("vehicle-parts.vue", () => {
|
||||||
wrapper.vm.backButtonAction();
|
wrapper.vm.backButtonAction();
|
||||||
|
|
||||||
//Assert
|
//Assert
|
||||||
expect(wrapper.vm.$router.navigateWithoutSaving).toHaveBeenCalledWith(navigationScenarios.CLICKED_BACK_TO_GO_TO_VIN_LOOKUP, wrapper.vm.$route);
|
expect(wrapper.vm.$router.navigateWithoutSaving).toHaveBeenCalledWith(navigationScenarios.CLICKED_BACK_WITH_NO_QUESTIONS, wrapper.vm.$route);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -76,6 +76,7 @@ export default {
|
||||||
|
|
||||||
// If we have exactly one style then navigate directly to vehicle-damage
|
// If we have exactly one style then navigate directly to vehicle-damage
|
||||||
if(resultMap.styleQuestionInitialData.length === 1 && !visitedVehicleDamage) {
|
if(resultMap.styleQuestionInitialData.length === 1 && !visitedVehicleDamage) {
|
||||||
|
// TODO KO
|
||||||
store.commit(storeMutations.UPDATE_STYLE, resultMap.styleQuestionInitialData[0]);
|
store.commit(storeMutations.UPDATE_STYLE, resultMap.styleQuestionInitialData[0]);
|
||||||
|
|
||||||
await store.dispatch(storeActions.SET_VEHICLE,
|
await store.dispatch(storeActions.SET_VEHICLE,
|
||||||
|
|
|
||||||
|
|
@ -115,6 +115,7 @@ export default {
|
||||||
// if single parts only
|
// if single parts only
|
||||||
const collectedGlassParts = this.reducedGlassPartsArray(partsOrQuestions);
|
const collectedGlassParts = this.reducedGlassPartsArray(partsOrQuestions);
|
||||||
// save to store lineItems.glassParts
|
// save to store lineItems.glassParts
|
||||||
|
// TODO KO
|
||||||
self.$store.commit(storeMutations.UPDATE_GLASS_PARTS, collectedGlassParts);
|
self.$store.commit(storeMutations.UPDATE_GLASS_PARTS, collectedGlassParts);
|
||||||
|
|
||||||
self.$refs.loadingModal.showModal();
|
self.$refs.loadingModal.showModal();
|
||||||
|
|
@ -127,20 +128,20 @@ export default {
|
||||||
const hasGlassLocationWithMultipleParts = this.hasGlassLocationWithMultipleParts(partsOrQuestions);
|
const hasGlassLocationWithMultipleParts = this.hasGlassLocationWithMultipleParts(partsOrQuestions);
|
||||||
const hasChildPartQuestions = this.hasChildPartQuestions(partsOrQuestions);
|
const hasChildPartQuestions = this.hasChildPartQuestions(partsOrQuestions);
|
||||||
const hasCapabilityQuestions = this.hasCapabilityQuestions(partsOrQuestions);
|
const hasCapabilityQuestions = this.hasCapabilityQuestions(partsOrQuestions);
|
||||||
let backNavigationScenario = navigationScenarios.CLICKED_BACK_TO_GO_TO_VIN_LOOKUP;
|
let backNavigationScenario = navigationScenarios.CLICKED_BACK_WITH_NO_QUESTIONS;
|
||||||
|
|
||||||
const currentPage = this.$route.query.fmgPage;
|
const currentPage = this.$route.query.fmgPage;
|
||||||
if (hasCapabilityQuestions && this.currentPageComesAfterPage(currentPage, fmgPageValues.CAPABILITY_QUESTIONS)) {
|
if (hasCapabilityQuestions && this.currentPageComesAfterPage(currentPage, fmgPageValues.CAPABILITY_QUESTIONS)) {
|
||||||
backNavigationScenario = navigationScenarios.CLICKED_BACK_TO_GO_TO_CAPABILITY_QUESTIONS;
|
backNavigationScenario = navigationScenarios.CLICKED_BACK_WITH_CAPABILITY_QUESTIONS;
|
||||||
}
|
}
|
||||||
else if (hasChildPartQuestions && this.currentPageComesAfterPage(currentPage, fmgPageValues.MOLDING_QUESTIONS)) {
|
else if (hasChildPartQuestions && this.currentPageComesAfterPage(currentPage, fmgPageValues.MOLDING_QUESTIONS)) {
|
||||||
backNavigationScenario = navigationScenarios.CLICKED_BACK_TO_GO_TO_MOLDING_QUESTIONS;
|
backNavigationScenario = navigationScenarios.CLICKED_BACK_WITH_MOLDING_QUESTIONS;
|
||||||
}
|
}
|
||||||
else if (hasGlassLocationWithMultipleParts && this.currentPageComesAfterPage(currentPage, fmgPageValues.VEHICLE_PARTS)) {
|
else if (hasGlassLocationWithMultipleParts && this.currentPageComesAfterPage(currentPage, fmgPageValues.VEHICLE_PARTS)) {
|
||||||
backNavigationScenario = navigationScenarios.CLICKED_BACK_TO_GO_TO_VEHICLE_PARTS;
|
backNavigationScenario = navigationScenarios.CLICKED_BACK_WITH_MULTIPLE_PARTS_TO_CHOOSE;
|
||||||
}
|
}
|
||||||
else if (hasPartQuestions && this.currentPageComesAfterPage(currentPage, fmgPageValues.PART_QUESTIONS)) {
|
else if (hasPartQuestions && this.currentPageComesAfterPage(currentPage, fmgPageValues.PART_QUESTIONS)) {
|
||||||
backNavigationScenario = navigationScenarios.CLICKED_BACK_TO_GO_TO_PART_QUESTIONS;
|
backNavigationScenario = navigationScenarios.CLICKED_BACK_WITH_PART_QUESTIONS;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$router.navigateWithoutSaving(
|
this.$router.navigateWithoutSaving(
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import { storeActions } from "@/constants/store-actions";
|
||||||
import loadingModal from '@/common-components/loading-modal/loading-modal.vue';
|
import loadingModal from '@/common-components/loading-modal/loading-modal.vue';
|
||||||
import { navigateToHeritageFunnel } from "@/helpers/heritage-integration/navigation-helper";
|
import { navigateToHeritageFunnel } from "@/helpers/heritage-integration/navigation-helper";
|
||||||
import { navigationScenarios } from "../router/router-constants/navigation-scenarios";
|
import { navigationScenarios } from "../router/router-constants/navigation-scenarios";
|
||||||
|
import { getters } from "@/store"
|
||||||
|
|
||||||
jest.mock("@/helpers/heritage-integration/navigation-helper", () => ({
|
jest.mock("@/helpers/heritage-integration/navigation-helper", () => ({
|
||||||
navigateToHeritageFunnel: jest.fn()
|
navigateToHeritageFunnel: jest.fn()
|
||||||
|
|
@ -154,6 +155,46 @@ describe("vehicle-questions-mixin", () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe("currentPageComesBeforePage", () => {
|
||||||
|
const testCases = [[fmgPageValues.PART_QUESTIONS, fmgPageValues.VEHICLE_PARTS, true],
|
||||||
|
[fmgPageValues.VEHICLE_PARTS, fmgPageValues.VEHICLE_PARTS, false],
|
||||||
|
[fmgPageValues.QUOTE, fmgPageValues.VEHICLE_PARTS, false],
|
||||||
|
[fmgPageValues.QUOTE, fmgPageValues.QUOTE, false],
|
||||||
|
[fmgPageValues.VEHICLE_PARTS, fmgPageValues.PART_QUESTIONS, false],
|
||||||
|
[fmgPageValues.PART_QUESTIONS, fmgPageValues.CAPABILITY_QUESTIONS, true],
|
||||||
|
[fmgPageValues.MOLDING_QUESTIONS, fmgPageValues.CAPABILITY_QUESTIONS, true],];
|
||||||
|
test.each(testCases)("%s comes before %s is %s", (currentPage, nextPage, expectedResult) => {
|
||||||
|
// Arrange
|
||||||
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
|
// Act
|
||||||
|
const result = wrapper.vm.currentPageComesBeforePage(currentPage, nextPage);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(result).toEqual(expectedResult);
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("currentPageComesAfterPage", () => {
|
||||||
|
const testCases = [[fmgPageValues.PART_QUESTIONS, fmgPageValues.VEHICLE_PARTS, false],
|
||||||
|
[fmgPageValues.VEHICLE_PARTS, fmgPageValues.VEHICLE_PARTS, false],
|
||||||
|
[fmgPageValues.QUOTE, fmgPageValues.VEHICLE_PARTS, true],
|
||||||
|
[fmgPageValues.QUOTE, fmgPageValues.QUOTE, false],
|
||||||
|
[fmgPageValues.VEHICLE_PARTS, fmgPageValues.PART_QUESTIONS, true],
|
||||||
|
[fmgPageValues.PART_QUESTIONS, fmgPageValues.CAPABILITY_QUESTIONS, false],
|
||||||
|
[fmgPageValues.MOLDING_QUESTIONS, fmgPageValues.CAPABILITY_QUESTIONS, false],];
|
||||||
|
test.each(testCases)("%s comes after %s is %s", (currentPage, nextPage, expectedResult) => {
|
||||||
|
// Arrange
|
||||||
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
|
// Act
|
||||||
|
const result = wrapper.vm.currentPageComesAfterPage(currentPage, nextPage);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(result).toEqual(expectedResult);
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
describe("navigateForward", () => {
|
describe("navigateForward", () => {
|
||||||
describe("should go to parts-questions", () => {
|
describe("should go to parts-questions", () => {
|
||||||
test("single glass location has part question => go to parts-questions", async () => {
|
test("single glass location has part question => go to parts-questions", async () => {
|
||||||
|
|
@ -890,20 +931,20 @@ describe("vehicle-questions-mixin", () => {
|
||||||
"childParts": null,
|
"childParts": null,
|
||||||
"childPartQuestions": [
|
"childPartQuestions": [
|
||||||
{
|
{
|
||||||
"questionSequence": 1,
|
"questionSequence": 1,
|
||||||
"questionText": "Does the rubber seal around your windshield have a chrome strip running through it?",
|
"questionText": "Does the rubber seal around your windshield have a chrome strip running through it?",
|
||||||
"answers": [
|
"answers": [
|
||||||
{
|
{
|
||||||
"answerResult": "WKT D1106 C",
|
"answerResult": "WKT D1106 C",
|
||||||
"answerText": "Yes",
|
"answerText": "Yes",
|
||||||
"nextQuestionSequence": null
|
"nextQuestionSequence": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"answerResult": "WKT D1106 B",
|
"answerResult": "WKT D1106 B",
|
||||||
"answerText": "No",
|
"answerText": "No",
|
||||||
"nextQuestionSequence": null
|
"nextQuestionSequence": null
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
@ -1105,7 +1146,63 @@ describe("vehicle-questions-mixin", () => {
|
||||||
expect(navigateToHeritageFunnel).toHaveBeenCalledTimes(1);
|
expect(navigateToHeritageFunnel).toHaveBeenCalledTimes(1);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
|
describe("backButtonAction", () => {
|
||||||
|
test("current page is quote and there are no questions => go to vin-lookup", () => {
|
||||||
|
// Arrange
|
||||||
|
const { wrapper } = setupMocks({ fmgPage: fmgPageValues.QUOTE });
|
||||||
|
|
||||||
|
// Act
|
||||||
|
wrapper.vm.backButtonAction();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(wrapper.vm.$router.navigateWithoutSaving).toHaveBeenCalledWith(navigationScenarios.CLICKED_BACK_WITH_NO_QUESTIONS, {"query": {"fmgPage": fmgPageValues.QUOTE}})
|
||||||
|
})
|
||||||
|
|
||||||
|
test("current page is quote and there are part questions and molding questions => go to molding questions", () => {
|
||||||
|
// Arrange
|
||||||
|
const { wrapper } = setupMocks({ fmgPage: fmgPageValues.QUOTE });
|
||||||
|
wrapper.vm.hasPartQuestions = jest.fn().mockReturnValue(true);
|
||||||
|
wrapper.vm.hasChildPartQuestions = jest.fn().mockReturnValue(true);
|
||||||
|
|
||||||
|
// Act
|
||||||
|
wrapper.vm.backButtonAction();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(wrapper.vm.$router.navigateWithoutSaving).toHaveBeenCalledWith(navigationScenarios.CLICKED_BACK_WITH_MOLDING_QUESTIONS, {"query": {"fmgPage": fmgPageValues.QUOTE}})
|
||||||
|
})
|
||||||
|
|
||||||
|
test("current page is molding questions and there are part questions, multiple parts to choose, and capability questions => go to vehicle-parts", () => {
|
||||||
|
// Arrange
|
||||||
|
const { wrapper } = setupMocks({ fmgPage: fmgPageValues.MOLDING_QUESTIONS });
|
||||||
|
wrapper.vm.hasPartQuestions = jest.fn().mockReturnValue(true);
|
||||||
|
wrapper.vm.hasGlassLocationWithMultipleParts = jest.fn().mockReturnValue(true);
|
||||||
|
wrapper.vm.hasChildPartQuestions = jest.fn().mockReturnValue(true);
|
||||||
|
wrapper.vm.hasCapabilityQuestions = jest.fn().mockReturnValue(true);
|
||||||
|
|
||||||
|
// Act
|
||||||
|
wrapper.vm.backButtonAction();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(wrapper.vm.$router.navigateWithoutSaving).toHaveBeenCalledWith(navigationScenarios.CLICKED_BACK_WITH_MULTIPLE_PARTS_TO_CHOOSE, {"query": {"fmgPage": fmgPageValues.MOLDING_QUESTIONS}})
|
||||||
|
})
|
||||||
|
|
||||||
|
test("current page is molding questions and there are part questions and capability questions => go to part-questions", () => {
|
||||||
|
// Arrange
|
||||||
|
const { wrapper } = setupMocks({ fmgPage: fmgPageValues.MOLDING_QUESTIONS });
|
||||||
|
wrapper.vm.hasPartQuestions = jest.fn().mockReturnValue(true);
|
||||||
|
wrapper.vm.hasGlassLocationWithMultipleParts = jest.fn().mockReturnValue(false);
|
||||||
|
wrapper.vm.hasChildPartQuestions = jest.fn().mockReturnValue(true);
|
||||||
|
wrapper.vm.hasCapabilityQuestions = jest.fn().mockReturnValue(true);
|
||||||
|
|
||||||
|
// Act
|
||||||
|
wrapper.vm.backButtonAction();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(wrapper.vm.$router.navigateWithoutSaving).toHaveBeenCalledWith(navigationScenarios.CLICKED_BACK_WITH_PART_QUESTIONS, {"query": {"fmgPage": fmgPageValues.MOLDING_QUESTIONS}})
|
||||||
|
})
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function setupMocks({ fmgPage = fmgPageValues.VIN_LOOKUP }) {
|
function setupMocks({ fmgPage = fmgPageValues.VIN_LOOKUP }) {
|
||||||
|
|
@ -1118,11 +1215,12 @@ function setupMocks({ fmgPage = fmgPageValues.VIN_LOOKUP }) {
|
||||||
|
|
||||||
const mocks = getMountOptions({
|
const mocks = getMountOptions({
|
||||||
router: {
|
router: {
|
||||||
navigate: jest.fn(), navigateWithSaving: jest.fn(), navigateWithSaving: jest.fn()
|
navigate: jest.fn(), navigateWithSaving: jest.fn(), navigateWithoutSaving: jest.fn()
|
||||||
},
|
},
|
||||||
store: {
|
store: {
|
||||||
commit: jest.fn(),
|
commit: jest.fn(),
|
||||||
dispatch: jest.fn()
|
dispatch: jest.fn(),
|
||||||
|
getters: getters
|
||||||
},
|
},
|
||||||
route: {
|
route: {
|
||||||
query: {
|
query: {
|
||||||
|
|
|
||||||
|
|
@ -25,10 +25,10 @@ const navigationScenarios = {
|
||||||
HAS_MOLDING_QUESTIONS: "HAS_MOLDING_QUESTIONS",
|
HAS_MOLDING_QUESTIONS: "HAS_MOLDING_QUESTIONS",
|
||||||
HAS_CAPABILITY_QUESTIONS: "HAS_CAPABILITY_QUESTIONS",
|
HAS_CAPABILITY_QUESTIONS: "HAS_CAPABILITY_QUESTIONS",
|
||||||
HAS_NO_MORE_QUESTIONS: "HAS_NO_MORE_QUESTIONS",
|
HAS_NO_MORE_QUESTIONS: "HAS_NO_MORE_QUESTIONS",
|
||||||
CLICKED_BACK_TO_GO_TO_VIN_LOOKUP: "CLICKED_BACK_TO_GO_TO_VIN_LOOKUP",
|
CLICKED_BACK_WITH_NO_QUESTIONS: "CLICKED_BACK_WITH_NO_QUESTIONS",
|
||||||
CLICKED_BACK_TO_GO_TO_PART_QUESTIONS: "CLICKED_BACK_TO_GO_TO_PART_QUESTIONS",
|
CLICKED_BACK_WITH_PART_QUESTIONS: "CLICKED_BACK_WITH_PART_QUESTIONS",
|
||||||
CLICKED_BACK_TO_GO_TO_VEHICLE_PARTS: "CLICKED_BACK_TO_GO_TO_VEHICLE_PARTS",
|
CLICKED_BACK_WITH_MULTIPLE_PARTS_TO_CHOOSE: "CLICKED_BACK_WITH_MULTIPLE_PARTS_TO_CHOOSE",
|
||||||
CLICKED_BACK_TO_GO_TO_MOLDING_QUESTIONS: "CLICKED_BACK_TO_GO_TO_MOLDING_QUESTIONS"
|
CLICKED_BACK_WITH_MOLDING_QUESTIONS: "CLICKED_BACK_WITH_MOLDING_QUESTIONS"
|
||||||
};
|
};
|
||||||
|
|
||||||
export { navigationScenarios };
|
export { navigationScenarios };
|
||||||
|
|
|
||||||
|
|
@ -237,7 +237,7 @@ const routingTable = function(store) {
|
||||||
fmgPageValue: fmgPageValues.PART_QUESTIONS,
|
fmgPageValue: fmgPageValues.PART_QUESTIONS,
|
||||||
maps: [
|
maps: [
|
||||||
{
|
{
|
||||||
scenario: navigationScenarios.CLICKED_BACK_TO_GO_TO_VIN_LOOKUP,
|
scenario: navigationScenarios.CLICKED_BACK_WITH_NO_QUESTIONS,
|
||||||
destinationFmgPageValue: fmgPageValues.VIN_LOOKUP
|
destinationFmgPageValue: fmgPageValues.VIN_LOOKUP
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -266,11 +266,11 @@ const routingTable = function(store) {
|
||||||
destinationFmgPageValue: fmgPageValues.REVEAL,
|
destinationFmgPageValue: fmgPageValues.REVEAL,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
scenario: navigationScenarios.CLICKED_BACK_TO_GO_TO_PART_QUESTIONS,
|
scenario: navigationScenarios.CLICKED_BACK_WITH_PART_QUESTIONS,
|
||||||
destinationFmgPageValue: fmgPageValues.PART_QUESTIONS,
|
destinationFmgPageValue: fmgPageValues.PART_QUESTIONS,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
scenario: navigationScenarios.CLICKED_BACK_TO_GO_TO_VIN_LOOKUP,
|
scenario: navigationScenarios.CLICKED_BACK_WITH_NO_QUESTIONS,
|
||||||
destinationFmgPageValue: fmgPageValues.VIN_LOOKUP,
|
destinationFmgPageValue: fmgPageValues.VIN_LOOKUP,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -291,15 +291,15 @@ const routingTable = function(store) {
|
||||||
fmgPageValue: fmgPageValues.MOLDING_QUESTIONS,
|
fmgPageValue: fmgPageValues.MOLDING_QUESTIONS,
|
||||||
maps: [
|
maps: [
|
||||||
{
|
{
|
||||||
scenario: navigationScenarios.CLICKED_BACK_TO_GO_TO_VIN_LOOKUP,
|
scenario: navigationScenarios.CLICKED_BACK_WITH_NO_QUESTIONS,
|
||||||
destinationFmgPageValue: fmgPageValues.VIN_LOOKUP
|
destinationFmgPageValue: fmgPageValues.VIN_LOOKUP
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
scenario: navigationScenarios.CLICKED_BACK_TO_GO_TO_PART_QUESTIONS,
|
scenario: navigationScenarios.CLICKED_BACK_WITH_PART_QUESTIONS,
|
||||||
destinationFmgPageValue: fmgPageValues.PART_QUESTIONS
|
destinationFmgPageValue: fmgPageValues.PART_QUESTIONS
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
scenario: navigationScenarios.CLICKED_BACK_TO_GO_TO_VEHICLE_PARTS,
|
scenario: navigationScenarios.CLICKED_BACK_WITH_MULTIPLE_PARTS_TO_CHOOSE,
|
||||||
destinationFmgPageValue: fmgPageValues.VEHICLE_PARTS
|
destinationFmgPageValue: fmgPageValues.VEHICLE_PARTS
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -316,19 +316,19 @@ const routingTable = function(store) {
|
||||||
fmgPageValue: fmgPageValues.CAPABILITY_QUESTIONS,
|
fmgPageValue: fmgPageValues.CAPABILITY_QUESTIONS,
|
||||||
maps: [
|
maps: [
|
||||||
{
|
{
|
||||||
scenario: navigationScenarios.CLICKED_BACK_TO_GO_TO_VIN_LOOKUP,
|
scenario: navigationScenarios.CLICKED_BACK_WITH_NO_QUESTIONS,
|
||||||
destinationFmgPageValue: fmgPageValues.VIN_LOOKUP
|
destinationFmgPageValue: fmgPageValues.VIN_LOOKUP
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
scenario: navigationScenarios.CLICKED_BACK_TO_GO_TO_PART_QUESTIONS,
|
scenario: navigationScenarios.CLICKED_BACK_WITH_PART_QUESTIONS,
|
||||||
destinationFmgPageValue: fmgPageValues.PART_QUESTIONS
|
destinationFmgPageValue: fmgPageValues.PART_QUESTIONS
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
scenario: navigationScenarios.CLICKED_BACK_TO_GO_TO_VEHICLE_PARTS,
|
scenario: navigationScenarios.CLICKED_BACK_WITH_MULTIPLE_PARTS_TO_CHOOSE,
|
||||||
destinationFmgPageValue: fmgPageValues.VEHICLE_PARTS
|
destinationFmgPageValue: fmgPageValues.VEHICLE_PARTS
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
scenario: navigationScenarios.CLICKED_BACK_TO_GO_TO_MOLDING_QUESTIONS,
|
scenario: navigationScenarios.CLICKED_BACK_WITH_MOLDING_QUESTIONS,
|
||||||
destinationFmgPageValue: fmgPageValues.MOLDING_QUESTIONS
|
destinationFmgPageValue: fmgPageValues.MOLDING_QUESTIONS
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1004,9 +1004,10 @@ export const actions = {
|
||||||
},
|
},
|
||||||
savePartQuestionAnswers(context, partQuestionAnswersArray) {
|
savePartQuestionAnswers(context, partQuestionAnswersArray) {
|
||||||
// if part question answers have changed, reset subsequent question answers
|
// if part question answers have changed, reset subsequent question answers
|
||||||
const previousResultsArray = context.getters.damage.partQuestionAnswers;
|
const sortedPreviousResultsArray = sortArrayOfObjectsByPropertyValue(context.getters.damage.partQuestionAnswers, "result");
|
||||||
const havePartQuestionAnswersChanged = previousResultsArray?.length !== partQuestionAnswersArray.length ||
|
const sortedPartQuestionAnswersArray = sortArrayOfObjectsByPropertyValue(partQuestionAnswersArray, "result")
|
||||||
!previousResultsArray.every((x, i) => x.result === partQuestionAnswersArray[i].result);
|
const havePartQuestionAnswersChanged = sortedPreviousResultsArray?.length !== sortedPartQuestionAnswersArray.length ||
|
||||||
|
!sortedPreviousResultsArray?.every((x, i) => x.result === sortedPartQuestionAnswersArray[i].result);
|
||||||
|
|
||||||
if (havePartQuestionAnswersChanged) {
|
if (havePartQuestionAnswersChanged) {
|
||||||
context.commit(storeMutations.UPDATE_GLASS_PARTS, null);
|
context.commit(storeMutations.UPDATE_GLASS_PARTS, null);
|
||||||
|
|
@ -1021,7 +1022,6 @@ export const actions = {
|
||||||
context.commit(storeMutations.UPDATE_PART_QUESTION_ANSWERS, partQuestionAnswersArray);
|
context.commit(storeMutations.UPDATE_PART_QUESTION_ANSWERS, partQuestionAnswersArray);
|
||||||
},
|
},
|
||||||
resetMoldingAndCapabilityQuestionAnswersIfNeeded(context, matchedParts) {
|
resetMoldingAndCapabilityQuestionAnswersIfNeeded(context, matchedParts) {
|
||||||
const previousResultsArray = [{ parts: context.getters.lineItems.glassParts }];
|
|
||||||
const partsOrQuestionsDataToCompareWith = context.getters.pageData(fmgPageValues.MOLDING_QUESTIONS)?.partsOrQuestions ?? context.getters.pageData(fmgPageValues.CAPABILITY_QUESTIONS)?.partsOrQuestions ?? [];
|
const partsOrQuestionsDataToCompareWith = context.getters.pageData(fmgPageValues.MOLDING_QUESTIONS)?.partsOrQuestions ?? context.getters.pageData(fmgPageValues.CAPABILITY_QUESTIONS)?.partsOrQuestions ?? [];
|
||||||
|
|
||||||
function getAllPartNumbers(partsOrQuestions) {
|
function getAllPartNumbers(partsOrQuestions) {
|
||||||
|
|
@ -1044,9 +1044,10 @@ export const actions = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
saveMoldingQuestionAnswers(context, moldingQuestionAnswers) {
|
saveMoldingQuestionAnswers(context, moldingQuestionAnswers) {
|
||||||
const previousResultsArray = context.getters.damage.moldingQuestionAnswers;
|
const sortedPreviousResultsArray = sortArrayOfObjectsByPropertyValue(context.getters.damage.moldingQuestionAnswers, "partNum");
|
||||||
const haveMoldingQuestionAnswersChanged = previousResultsArray?.length !== moldingQuestionAnswers.length ||
|
const sortedMoldingQuestionAnswersArray = sortArrayOfObjectsByPropertyValue(moldingQuestionAnswers, "partNum");
|
||||||
!previousResultsArray.every((x, i) => x.partNum === moldingQuestionAnswers[i].partNum);
|
const haveMoldingQuestionAnswersChanged = sortedPreviousResultsArray?.length !== sortedMoldingQuestionAnswersArray.length ||
|
||||||
|
!sortedPreviousResultsArray?.every((x, i) => x.partNum === sortedMoldingQuestionAnswersArray[i].partNum);
|
||||||
|
|
||||||
if (haveMoldingQuestionAnswersChanged) {
|
if (haveMoldingQuestionAnswersChanged) {
|
||||||
context.commit(storeMutations.UPDATE_GLASS_PARTS, null);
|
context.commit(storeMutations.UPDATE_GLASS_PARTS, null);
|
||||||
|
|
@ -1058,9 +1059,10 @@ export const actions = {
|
||||||
context.commit(storeMutations.UPDATE_MOLDING_QUESTION_ANSWERS, moldingQuestionAnswers);
|
context.commit(storeMutations.UPDATE_MOLDING_QUESTION_ANSWERS, moldingQuestionAnswers);
|
||||||
},
|
},
|
||||||
saveCapabilityQuestionAnswers(context, capabilityQuestionAnswers) {
|
saveCapabilityQuestionAnswers(context, capabilityQuestionAnswers) {
|
||||||
const previousResultsArray = context.getters.damage.capabilityQuestionAnswers;
|
const sortedPreviousResultsArray = sortArrayOfObjectsByPropertyValue(context.getters.damage.capabilityQuestionAnswers, "result");
|
||||||
const haveCapabilityQuestionAnswersChanged = previousResultsArray?.length !== capabilityQuestionAnswers.length ||
|
const sortedCapabilityQuestionAnswersArray = sortArrayOfObjectsByPropertyValue(capabilityQuestionAnswers, "result");
|
||||||
!previousResultsArray.every((x, i) => x.result === capabilityQuestionAnswers[i].result);
|
const haveCapabilityQuestionAnswersChanged = sortedPreviousResultsArray?.length !== sortedCapabilityQuestionAnswersArray.length ||
|
||||||
|
!sortedPreviousResultsArray?.every((x, i) => x.result === sortedCapabilityQuestionAnswersArray[i].result);
|
||||||
|
|
||||||
if (haveCapabilityQuestionAnswersChanged) {
|
if (haveCapabilityQuestionAnswersChanged) {
|
||||||
context.commit(storeMutations.UPDATE_GLASS_PARTS, null);
|
context.commit(storeMutations.UPDATE_GLASS_PARTS, null);
|
||||||
|
|
@ -1127,3 +1129,16 @@ function getHasRecalibrationPart(state) {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function sortArrayOfObjectsByPropertyValue(arrayOfObjects, propertyName) {
|
||||||
|
if (!arrayOfObjects) return null;
|
||||||
|
|
||||||
|
return arrayOfObjects.sort((a, b) => {
|
||||||
|
if (a[propertyName] < b[propertyName])
|
||||||
|
return -1;
|
||||||
|
else if (a[propertyName] > b[propertyName])
|
||||||
|
return 1;
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
@ -3,6 +3,7 @@ import { mutations, state, actions, getters } from "@/store";
|
||||||
import { storeMutations } from "@/constants/store-mutations";
|
import { storeMutations } from "@/constants/store-mutations";
|
||||||
import { storeActions } from "@/constants/store-actions";
|
import { storeActions } from "@/constants/store-actions";
|
||||||
import { experimentTriggers } from "@/constants/experiments";
|
import { experimentTriggers } from "@/constants/experiments";
|
||||||
|
import { fmgPageValues } from "@/router/router-constants/fmgPage-values"
|
||||||
|
|
||||||
// Mock global method
|
// Mock global method
|
||||||
globalMethods.callHttpClient = jest.fn();
|
globalMethods.callHttpClient = jest.fn();
|
||||||
|
|
@ -258,9 +259,9 @@ describe("Mutations", () => {
|
||||||
{
|
{
|
||||||
universeName: "XYZ",
|
universeName: "XYZ",
|
||||||
settings: {
|
settings: {
|
||||||
ExperimentSetting: "ExperimentValue"
|
ExperimentSetting: "ExperimentValue"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
|
|
@ -1065,7 +1066,7 @@ describe("Actions", () => {
|
||||||
context.state = {
|
context.state = {
|
||||||
order: {
|
order: {
|
||||||
damage: {
|
damage: {
|
||||||
glassToReplace: [{glassName: 'Single', glassLocation: 'Windshield'}]
|
glassToReplace: [{ glassName: 'Single', glassLocation: 'Windshield' }]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -1077,7 +1078,7 @@ describe("Actions", () => {
|
||||||
context.dispatch = dispatch;
|
context.dispatch = dispatch;
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
const payload = { isWindshieldRepair: false, selectedGlassToReplace: [{glassName: 'Rear', glassLocation: 'quarter'}], selectedWindshieldChipCount: 0};
|
const payload = { isWindshieldRepair: false, selectedGlassToReplace: [{ glassName: 'Rear', glassLocation: 'quarter' }], selectedWindshieldChipCount: 0 };
|
||||||
actions.saveVehicleDamage(context, payload);
|
actions.saveVehicleDamage(context, payload);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
|
|
@ -1156,50 +1157,677 @@ describe("Actions", () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
describe("savePartQuestionAnswers", () => {
|
describe("savePartQuestionAnswers", () => {
|
||||||
test.todo("saves partQuestionAnswers")
|
let context;
|
||||||
|
beforeEach(() => {
|
||||||
|
jest.clearAllMocks();
|
||||||
|
mutations.resetState(state);
|
||||||
|
context = state;
|
||||||
|
context.commit = jest.fn().mockImplementation((storeMutation, value) => mutations[storeMutation](context, value));
|
||||||
|
context.getters = {
|
||||||
|
...getters,
|
||||||
|
damage: getters.damage(context)
|
||||||
|
};
|
||||||
|
})
|
||||||
|
|
||||||
test.todo("there are no previous answers => resets necessary fields")
|
function testPartQuestionAnswerDependenciesHaveBeenReset(context, shouldPartQuestionAnswersBeReset) {
|
||||||
|
if (shouldPartQuestionAnswersBeReset) {
|
||||||
|
expect(context.commit).toBeCalledWith(storeMutations.UPDATE_GLASS_PARTS, null);
|
||||||
|
expect(context.commit).toBeCalledWith(storeMutations.UPDATE_MOLDING_QUESTION_ANSWERS, null);
|
||||||
|
expect(context.commit).toBeCalledWith(storeMutations.UPDATE_CAPABILITY_QUESTION_ANSWERS, null);
|
||||||
|
expect(context.commit).toBeCalledWith(storeMutations.UPDATE_PAGE_DATA, { page: fmgPageValues.VEHICLE_PARTS, data: null });
|
||||||
|
expect(context.commit).toBeCalledWith(storeMutations.UPDATE_PAGE_DATA, { page: fmgPageValues.MOLDING_QUESTIONS, data: null });
|
||||||
|
expect(context.commit).toBeCalledWith(storeMutations.UPDATE_PAGE_DATA, { page: fmgPageValues.CAPABILITY_QUESTIONS, data: null });
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
expect(context.commit).not.toBeCalledWith(storeMutations.UPDATE_GLASS_PARTS, null);
|
||||||
|
expect(context.commit).not.toBeCalledWith(storeMutations.UPDATE_MOLDING_QUESTION_ANSWERS, null);
|
||||||
|
expect(context.commit).not.toBeCalledWith(storeMutations.UPDATE_CAPABILITY_QUESTION_ANSWERS, null);
|
||||||
|
expect(context.commit).not.toBeCalledWith(storeMutations.UPDATE_PAGE_DATA, { page: fmgPageValues.VEHICLE_PARTS, data: null });
|
||||||
|
expect(context.commit).not.toBeCalledWith(storeMutations.UPDATE_PAGE_DATA, { page: fmgPageValues.MOLDING_QUESTIONS, data: null });
|
||||||
|
expect(context.commit).not.toBeCalledWith(storeMutations.UPDATE_PAGE_DATA, { page: fmgPageValues.CAPABILITY_QUESTIONS, data: null });
|
||||||
|
}
|
||||||
|
|
||||||
// mix up the order to make sure sort is working
|
expect(context.commit).toBeCalledWith(storeMutations.UPDATE_PART_QUESTION_ANSWERS, expect.anything());
|
||||||
test.todo("previous answers match current answers => does not reset fields")
|
}
|
||||||
|
|
||||||
test.todo("previous answers does not match current answers => resets necessary fields")
|
test("there are no previous answers => resets necessary fields", async () => {
|
||||||
|
// Arrange
|
||||||
|
const previousPartQuestionAnswers = [];
|
||||||
|
const currentPartQuestionAnswers = [{ result: "I'M A PART!" }, { result: "I'M A PART3!" }, { result: "I'M A PART2!" }];
|
||||||
|
|
||||||
|
actions.savePartQuestionAnswers(context, previousPartQuestionAnswers);
|
||||||
|
jest.clearAllMocks();
|
||||||
|
|
||||||
|
// Act
|
||||||
|
actions.savePartQuestionAnswers(context, currentPartQuestionAnswers);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
testPartQuestionAnswerDependenciesHaveBeenReset(context, true);
|
||||||
|
})
|
||||||
|
|
||||||
|
test("previous answers does not match current answers => resets necessary fields", () => {
|
||||||
|
// Arrange
|
||||||
|
const previousPartQuestionAnswers = [{ result: "I'M A PART2!" }, { result: "I'M A PART4!" }, { result: "I'M A PART3!" }];
|
||||||
|
const currentPartQuestionAnswers = [{ result: "I'M A PART!" }, { result: "I'M A PART3!" }, { result: "I'M A PART2!" }];
|
||||||
|
|
||||||
|
actions.savePartQuestionAnswers(context, previousPartQuestionAnswers);
|
||||||
|
jest.clearAllMocks();
|
||||||
|
|
||||||
|
// Act
|
||||||
|
actions.savePartQuestionAnswers(context, currentPartQuestionAnswers);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
testPartQuestionAnswerDependenciesHaveBeenReset(context, true);
|
||||||
|
})
|
||||||
|
|
||||||
|
test("previous answers match current answers => does not reset fields", () => {
|
||||||
|
// Arrange
|
||||||
|
const previousPartQuestionAnswers = [{ result: "I'M A PART2!" }, { result: "I'M A PART!" }, { result: "I'M A PART3!" }];
|
||||||
|
const currentPartQuestionAnswers = [{ result: "I'M A PART!" }, { result: "I'M A PART3!" }, { result: "I'M A PART2!" }];
|
||||||
|
|
||||||
|
actions.savePartQuestionAnswers(context, previousPartQuestionAnswers);
|
||||||
|
jest.clearAllMocks();
|
||||||
|
|
||||||
|
// Act
|
||||||
|
actions.savePartQuestionAnswers(context, currentPartQuestionAnswers);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
testPartQuestionAnswerDependenciesHaveBeenReset(context, false);
|
||||||
|
})
|
||||||
|
test("previous answers have more questions/answers than current => resets fields", () => {
|
||||||
|
// Arrange
|
||||||
|
const previousPartQuestionAnswers = [{ result: "I'M A PART2!" }, { result: "I'M A PART!" }, { result: "I'M A PART3!" }];
|
||||||
|
const currentPartQuestionAnswers = [{ result: "I'M A PART!" }, { result: "I'M A PART3!" }];
|
||||||
|
|
||||||
|
actions.savePartQuestionAnswers(context, previousPartQuestionAnswers);
|
||||||
|
jest.clearAllMocks();
|
||||||
|
|
||||||
|
// Act
|
||||||
|
actions.savePartQuestionAnswers(context, currentPartQuestionAnswers);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
testPartQuestionAnswerDependenciesHaveBeenReset(context, true);
|
||||||
|
})
|
||||||
|
|
||||||
|
test("current answers have more questions/answers than previous => resets fields", () => {
|
||||||
|
// Arrange
|
||||||
|
const previousPartQuestionAnswers = [{ result: "I'M A PART2!" }, { result: "I'M A PART3!" }];
|
||||||
|
const currentPartQuestionAnswers = [{ result: "I'M A PART!" }, { result: "I'M A PART3!" }, { result: "I'M A PART2!" }];
|
||||||
|
|
||||||
|
actions.savePartQuestionAnswers(context, previousPartQuestionAnswers);
|
||||||
|
jest.clearAllMocks();
|
||||||
|
|
||||||
|
// Act
|
||||||
|
actions.savePartQuestionAnswers(context, currentPartQuestionAnswers);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
testPartQuestionAnswerDependenciesHaveBeenReset(context, true);
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe("resetMoldingAndCapabilityQuestionAnswersIfNeeded", () => {
|
describe("resetMoldingAndCapabilityQuestionAnswersIfNeeded", () => {
|
||||||
test.todo("there are no saved parts => resets necessary fields")
|
let context;
|
||||||
|
beforeEach(() => {
|
||||||
|
mutations.resetState(state);
|
||||||
|
context = state;
|
||||||
|
context.commit = jest.fn().mockImplementation((storeMutation, value) => mutations[storeMutation](context, value));
|
||||||
|
context.getters = {
|
||||||
|
...getters,
|
||||||
|
pageData: getters.pageData(context)
|
||||||
|
};
|
||||||
|
})
|
||||||
|
|
||||||
// make sure you check the different variations where molding-questions and capability-questions do or don't have pageData
|
function testVehiclePartDependenciesHaveBeenReset(context, shouldAnswersBeReset) {
|
||||||
// mix up the order to make sure sort is working
|
if (shouldAnswersBeReset) {
|
||||||
test.todo("previously saved parts match selected parts => does not reset fields")
|
expect(context.commit).toBeCalledWith(storeMutations.UPDATE_GLASS_PARTS, null);
|
||||||
|
expect(context.commit).toBeCalledWith(storeMutations.UPDATE_MOLDING_QUESTION_ANSWERS, null);
|
||||||
|
expect(context.commit).toBeCalledWith(storeMutations.UPDATE_CAPABILITY_QUESTION_ANSWERS, null);
|
||||||
|
expect(context.commit).toBeCalledWith(storeMutations.UPDATE_PAGE_DATA, { page: fmgPageValues.MOLDING_QUESTIONS, data: null });
|
||||||
|
expect(context.commit).toBeCalledWith(storeMutations.UPDATE_PAGE_DATA, { page: fmgPageValues.CAPABILITY_QUESTIONS, data: null });
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
expect(context.commit).not.toBeCalledWith(storeMutations.UPDATE_GLASS_PARTS, null);
|
||||||
|
expect(context.commit).not.toBeCalledWith(storeMutations.UPDATE_MOLDING_QUESTION_ANSWERS, null);
|
||||||
|
expect(context.commit).not.toBeCalledWith(storeMutations.UPDATE_CAPABILITY_QUESTION_ANSWERS, null);
|
||||||
|
expect(context.commit).not.toBeCalledWith(storeMutations.UPDATE_PAGE_DATA, { page: fmgPageValues.MOLDING_QUESTIONS, data: null });
|
||||||
|
expect(context.commit).not.toBeCalledWith(storeMutations.UPDATE_PAGE_DATA, { page: fmgPageValues.CAPABILITY_QUESTIONS, data: null });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
test.todo("previously saved parts do not match selected parts => resets necessary fields")
|
test("there are no saved parts from molding or capability question pages => resets necessary fields", () => {
|
||||||
|
// Arrange
|
||||||
|
const previouslySelectedParts = {};
|
||||||
|
|
||||||
|
const currentlySelectedParts = [
|
||||||
|
{
|
||||||
|
glassLocation: "Windshield",
|
||||||
|
glassName: "Single",
|
||||||
|
parts: [{ partNumber: "PART3" }, { partNumber: "PART1" }, { partNumber: "PART2" }]
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
mutations.updatePageData(context, {
|
||||||
|
page: fmgPageValues.MOLDING_QUESTIONS,
|
||||||
|
data: previouslySelectedParts
|
||||||
|
});
|
||||||
|
|
||||||
|
mutations.updatePageData(context, {
|
||||||
|
page: fmgPageValues.CAPABILITY_QUESTIONS,
|
||||||
|
data: previouslySelectedParts
|
||||||
|
});
|
||||||
|
|
||||||
|
// Act
|
||||||
|
actions.resetMoldingAndCapabilityQuestionAnswersIfNeeded(context, currentlySelectedParts);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
testVehiclePartDependenciesHaveBeenReset(context, true);
|
||||||
|
})
|
||||||
|
|
||||||
|
describe("previously saved parts from molding-questions match selected parts => does not reset fields", () => {
|
||||||
|
test("single glass location", () => {
|
||||||
|
// Arrange
|
||||||
|
const previouslySelectedParts = {
|
||||||
|
partsOrQuestions: [
|
||||||
|
{
|
||||||
|
glassLocation: "Windshield",
|
||||||
|
glassName: "Single",
|
||||||
|
parts: [{ partNumber: "PART1" }, { partNumber: "PART2" }, { partNumber: "PART3" }]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
const currentlySelectedParts = [
|
||||||
|
{
|
||||||
|
glassLocation: "Windshield",
|
||||||
|
glassName: "Single",
|
||||||
|
parts: [{ partNumber: "PART3" }, { partNumber: "PART1" }, { partNumber: "PART2" }]
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
mutations.updatePageData(context, {
|
||||||
|
page: fmgPageValues.MOLDING_QUESTIONS,
|
||||||
|
data: previouslySelectedParts
|
||||||
|
});
|
||||||
|
|
||||||
|
// Act
|
||||||
|
actions.resetMoldingAndCapabilityQuestionAnswersIfNeeded(context, currentlySelectedParts);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
testVehiclePartDependenciesHaveBeenReset(context, false);
|
||||||
|
})
|
||||||
|
|
||||||
|
test("multiple glass locations", () => {
|
||||||
|
// Arrange
|
||||||
|
const previouslySelectedParts = {
|
||||||
|
partsOrQuestions: [
|
||||||
|
{
|
||||||
|
glassLocation: "Windshield",
|
||||||
|
glassName: "Single",
|
||||||
|
parts: [{ partNumber: "PART1" }, { partNumber: "PART2" }, { partNumber: "PART3" }]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
glassLocation: "Driver",
|
||||||
|
glassName: "Front",
|
||||||
|
parts: [{ partNumber: "PART5" }, { partNumber: "PART4" }]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
const currentlySelectedParts = [
|
||||||
|
{
|
||||||
|
glassLocation: "Driver",
|
||||||
|
glassName: "Front",
|
||||||
|
parts: [{ partNumber: "PART4" }, { partNumber: "PART5" }]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
glassLocation: "Windshield",
|
||||||
|
glassName: "Single",
|
||||||
|
parts: [{ partNumber: "PART3" }, { partNumber: "PART1" }, { partNumber: "PART2" }]
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
mutations.updatePageData(context, {
|
||||||
|
page: fmgPageValues.MOLDING_QUESTIONS,
|
||||||
|
data: previouslySelectedParts
|
||||||
|
});
|
||||||
|
|
||||||
|
// Act
|
||||||
|
actions.resetMoldingAndCapabilityQuestionAnswersIfNeeded(context, currentlySelectedParts);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
testVehiclePartDependenciesHaveBeenReset(context, false);
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
describe("previously saved parts from capability-questions match selected parts and there are none from molding-questions => does not reset fields", () => {
|
||||||
|
test("Single glass location", () => {
|
||||||
|
// Arrange
|
||||||
|
const previouslySelectedParts = {
|
||||||
|
partsOrQuestions: [
|
||||||
|
{
|
||||||
|
glassLocation: "Windshield",
|
||||||
|
glassName: "Single",
|
||||||
|
parts: [{ partNumber: "PART1" }, { partNumber: "PART2" }, { partNumber: "PART3" }]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
const currentlySelectedParts = [
|
||||||
|
{
|
||||||
|
glassLocation: "Windshield",
|
||||||
|
glassName: "Single",
|
||||||
|
parts: [{ partNumber: "PART3" }, { partNumber: "PART1" }, { partNumber: "PART2" }]
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
mutations.updatePageData(context, {
|
||||||
|
page: fmgPageValues.CAPABILITY_QUESTIONS,
|
||||||
|
data: previouslySelectedParts
|
||||||
|
});
|
||||||
|
|
||||||
|
// Act
|
||||||
|
actions.resetMoldingAndCapabilityQuestionAnswersIfNeeded(context, currentlySelectedParts);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
testVehiclePartDependenciesHaveBeenReset(context, false);
|
||||||
|
})
|
||||||
|
|
||||||
|
test("multiple glass locations", () => {
|
||||||
|
// Arrange
|
||||||
|
const previouslySelectedParts = {
|
||||||
|
partsOrQuestions: [
|
||||||
|
{
|
||||||
|
glassLocation: "Windshield",
|
||||||
|
glassName: "Single",
|
||||||
|
parts: [{ partNumber: "PART1" }, { partNumber: "PART2" }, { partNumber: "PART3" }]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
glassLocation: "Driver",
|
||||||
|
glassName: "Front",
|
||||||
|
parts: [{ partNumber: "PART5" }, { partNumber: "PART4" }]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
const currentlySelectedParts = [
|
||||||
|
{
|
||||||
|
glassLocation: "Driver",
|
||||||
|
glassName: "Front",
|
||||||
|
parts: [{ partNumber: "PART4" }, { partNumber: "PART5" }]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
glassLocation: "Windshield",
|
||||||
|
glassName: "Single",
|
||||||
|
parts: [{ partNumber: "PART3" }, { partNumber: "PART1" }, { partNumber: "PART2" }]
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
mutations.updatePageData(context, {
|
||||||
|
page: fmgPageValues.CAPABILITY_QUESTIONS,
|
||||||
|
data: previouslySelectedParts
|
||||||
|
});
|
||||||
|
|
||||||
|
// Act
|
||||||
|
actions.resetMoldingAndCapabilityQuestionAnswersIfNeeded(context, currentlySelectedParts);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
testVehiclePartDependenciesHaveBeenReset(context, false);
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
describe("previously saved parts from molding-questions do not match selected parts => resets necessary fields", () => {
|
||||||
|
test("single glass location", () => {
|
||||||
|
// Arrange
|
||||||
|
const previouslySelectedParts = {
|
||||||
|
partsOrQuestions: [
|
||||||
|
{
|
||||||
|
glassLocation: "Windshield",
|
||||||
|
glassName: "Single",
|
||||||
|
parts: [{ partNumber: "PART1" }, { partNumber: "PART6" }, { partNumber: "PART3" }]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
const currentlySelectedParts = [
|
||||||
|
{
|
||||||
|
glassLocation: "Windshield",
|
||||||
|
glassName: "Single",
|
||||||
|
parts: [{ partNumber: "PART3" }, { partNumber: "PART1" }, { partNumber: "PART2" }]
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
mutations.updatePageData(context, {
|
||||||
|
page: fmgPageValues.MOLDING_QUESTIONS,
|
||||||
|
data: previouslySelectedParts
|
||||||
|
});
|
||||||
|
|
||||||
|
// Act
|
||||||
|
actions.resetMoldingAndCapabilityQuestionAnswersIfNeeded(context, currentlySelectedParts);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
testVehiclePartDependenciesHaveBeenReset(context, true);
|
||||||
|
})
|
||||||
|
|
||||||
|
test("multiple glass locations", () => {
|
||||||
|
// Arrange
|
||||||
|
const previouslySelectedParts = {
|
||||||
|
partsOrQuestions: [
|
||||||
|
{
|
||||||
|
glassLocation: "Windshield",
|
||||||
|
glassName: "Single",
|
||||||
|
parts: [{ partNumber: "PART1" }, { partNumber: "PART6" }, { partNumber: "PART3" }]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
glassLocation: "Driver",
|
||||||
|
glassName: "Front",
|
||||||
|
parts: [{ partNumber: "PART5" }, { partNumber: "PART4" }]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
const currentlySelectedParts = [
|
||||||
|
{
|
||||||
|
glassLocation: "Driver",
|
||||||
|
glassName: "Front",
|
||||||
|
parts: [{ partNumber: "PART4" }, { partNumber: "PART5" }]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
glassLocation: "Windshield",
|
||||||
|
glassName: "Single",
|
||||||
|
parts: [{ partNumber: "PART3" }, { partNumber: "PART1" }, { partNumber: "PART2" }]
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
mutations.updatePageData(context, {
|
||||||
|
page: fmgPageValues.MOLDING_QUESTIONS,
|
||||||
|
data: previouslySelectedParts
|
||||||
|
});
|
||||||
|
|
||||||
|
// Act
|
||||||
|
actions.resetMoldingAndCapabilityQuestionAnswersIfNeeded(context, currentlySelectedParts);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
testVehiclePartDependenciesHaveBeenReset(context, true);
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
describe("previously saved parts from capability-questions do not match selected parts => resets necessary fields", () => {
|
||||||
|
test("single glass location", () => {
|
||||||
|
// Arrange
|
||||||
|
const previouslySelectedParts = {
|
||||||
|
partsOrQuestions: [
|
||||||
|
{
|
||||||
|
glassLocation: "Windshield",
|
||||||
|
glassName: "Single",
|
||||||
|
parts: [{ partNumber: "PART1" }, { partNumber: "PART6" }, { partNumber: "PART3" }]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
const currentlySelectedParts = [
|
||||||
|
{
|
||||||
|
glassLocation: "Windshield",
|
||||||
|
glassName: "Single",
|
||||||
|
parts: [{ partNumber: "PART3" }, { partNumber: "PART1" }, { partNumber: "PART2" }]
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
mutations.updatePageData(context, {
|
||||||
|
page: fmgPageValues.MOLDING_QUESTIONS,
|
||||||
|
data: previouslySelectedParts
|
||||||
|
});
|
||||||
|
|
||||||
|
// Act
|
||||||
|
actions.resetMoldingAndCapabilityQuestionAnswersIfNeeded(context, currentlySelectedParts);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
testVehiclePartDependenciesHaveBeenReset(context, true);
|
||||||
|
})
|
||||||
|
|
||||||
|
test("multiple glass locations", () => {
|
||||||
|
// Arrange
|
||||||
|
const previouslySelectedParts = {
|
||||||
|
partsOrQuestions: [
|
||||||
|
{
|
||||||
|
glassLocation: "Windshield",
|
||||||
|
glassName: "Single",
|
||||||
|
parts: [{ partNumber: "PART1" }, { partNumber: "PART6" }, { partNumber: "PART3" }]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
glassLocation: "Driver",
|
||||||
|
glassName: "Front",
|
||||||
|
parts: [{ partNumber: "PART5" }, { partNumber: "PART4" }]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
const currentlySelectedParts = [
|
||||||
|
{
|
||||||
|
glassLocation: "Driver",
|
||||||
|
glassName: "Front",
|
||||||
|
parts: [{ partNumber: "PART4" }, { partNumber: "PART5" }]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
glassLocation: "Windshield",
|
||||||
|
glassName: "Single",
|
||||||
|
parts: [{ partNumber: "PART3" }, { partNumber: "PART1" }, { partNumber: "PART2" }]
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
mutations.updatePageData(context, {
|
||||||
|
page: fmgPageValues.CAPABILITY_QUESTIONS,
|
||||||
|
data: previouslySelectedParts
|
||||||
|
});
|
||||||
|
|
||||||
|
// Act
|
||||||
|
actions.resetMoldingAndCapabilityQuestionAnswersIfNeeded(context, currentlySelectedParts);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
testVehiclePartDependenciesHaveBeenReset(context, true);
|
||||||
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe("saveMoldingQuestionAnswers", () => {
|
describe("saveMoldingQuestionAnswers", () => {
|
||||||
test.todo("saves moldingQuestionAnswers")
|
let context;
|
||||||
|
beforeEach(() => {
|
||||||
|
jest.clearAllMocks();
|
||||||
|
mutations.resetState(state);
|
||||||
|
context = state;
|
||||||
|
context.commit = jest.fn().mockImplementation((storeMutation, value) => mutations[storeMutation](context, value));
|
||||||
|
context.getters = {
|
||||||
|
...getters,
|
||||||
|
damage: getters.damage(context)
|
||||||
|
};
|
||||||
|
})
|
||||||
|
|
||||||
test.todo("there are no previous answers => resets necessary fields")
|
function testMoldingQuestionAnswerDependenciesHaveBeenReset(context, shouldAnswersBeReset) {
|
||||||
|
if (shouldAnswersBeReset) {
|
||||||
|
expect(context.commit).toBeCalledWith(storeMutations.UPDATE_GLASS_PARTS, null);
|
||||||
|
expect(context.commit).toBeCalledWith(storeMutations.UPDATE_CAPABILITY_QUESTION_ANSWERS, null);
|
||||||
|
expect(context.commit).toBeCalledWith(storeMutations.UPDATE_PAGE_DATA, { page: fmgPageValues.CAPABILITY_QUESTIONS, data: null });
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
expect(context.commit).not.toBeCalledWith(storeMutations.UPDATE_GLASS_PARTS, null);
|
||||||
|
expect(context.commit).not.toBeCalledWith(storeMutations.UPDATE_CAPABILITY_QUESTION_ANSWERS, null);
|
||||||
|
expect(context.commit).not.toBeCalledWith(storeMutations.UPDATE_PAGE_DATA, { page: fmgPageValues.CAPABILITY_QUESTIONS, data: null });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// mix up the order to make sure sort is working
|
test("there are no previous answers => resets necessary fields", () => {
|
||||||
test.todo("previous answers match current answers => does not reset fields")
|
// Arrange
|
||||||
|
const previousMoldingQuestionAnswers = [];
|
||||||
|
const currentMoldingQuestionAnswers = [{ partNum: "I'M A PART!" }, { partNum: "I'M A PART3!" }, { partNum: "I'M A PART2!" }];
|
||||||
|
|
||||||
test.todo("previous answers does not match current answers => resets necessary fields")
|
actions.saveMoldingQuestionAnswers(context, previousMoldingQuestionAnswers);
|
||||||
|
jest.clearAllMocks();
|
||||||
|
|
||||||
|
// Act
|
||||||
|
actions.saveMoldingQuestionAnswers(context, currentMoldingQuestionAnswers);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
testMoldingQuestionAnswerDependenciesHaveBeenReset(context, true);
|
||||||
|
})
|
||||||
|
|
||||||
|
test("previous answers match current answers => does not reset fields", () => {
|
||||||
|
// Arrange
|
||||||
|
const previousMoldingQuestionAnswers = [{ partNum: "I'M A PART2!" }, { partNum: "I'M A PART3!" }, { partNum: "I'M A PART!" }];;
|
||||||
|
const currentMoldingQuestionAnswers = [{ partNum: "I'M A PART!" }, { partNum: "I'M A PART3!" }, { partNum: "I'M A PART2!" }];
|
||||||
|
|
||||||
|
actions.saveMoldingQuestionAnswers(context, previousMoldingQuestionAnswers);
|
||||||
|
jest.clearAllMocks();
|
||||||
|
|
||||||
|
// Act
|
||||||
|
actions.saveMoldingQuestionAnswers(context, currentMoldingQuestionAnswers);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
testMoldingQuestionAnswerDependenciesHaveBeenReset(context, false);
|
||||||
|
})
|
||||||
|
|
||||||
|
test("previous answers do not match current answers => resets necessary fields", () => {
|
||||||
|
// Arrange
|
||||||
|
const previousMoldingQuestionAnswers = [{ partNum: "I'M A PART2!" }, { partNum: "I'M A PART4!" }, { partNum: "I'M A PART!" }];;
|
||||||
|
const currentMoldingQuestionAnswers = [{ partNum: "I'M A PART!" }, { partNum: "I'M A PART3!" }, { partNum: "I'M A PART2!" }];
|
||||||
|
|
||||||
|
actions.saveMoldingQuestionAnswers(context, previousMoldingQuestionAnswers);
|
||||||
|
jest.clearAllMocks();
|
||||||
|
|
||||||
|
// Act
|
||||||
|
actions.saveMoldingQuestionAnswers(context, currentMoldingQuestionAnswers);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
testMoldingQuestionAnswerDependenciesHaveBeenReset(context, true);
|
||||||
|
})
|
||||||
|
|
||||||
|
test("previous answers have more questions/answers than current => resets fields", () => {
|
||||||
|
// Arrange
|
||||||
|
const previousMoldingQuestionAnswers = [{ partNum: "I'M A PART2!" }, { partNum: "I'M A PART4!" }, { partNum: "I'M A PART!" }];;
|
||||||
|
const currentMoldingQuestionAnswers = [{ partNum: "I'M A PART!" }];
|
||||||
|
|
||||||
|
actions.saveMoldingQuestionAnswers(context, previousMoldingQuestionAnswers);
|
||||||
|
jest.clearAllMocks();
|
||||||
|
|
||||||
|
// Act
|
||||||
|
actions.saveMoldingQuestionAnswers(context, currentMoldingQuestionAnswers);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
testMoldingQuestionAnswerDependenciesHaveBeenReset(context, true);
|
||||||
|
})
|
||||||
|
|
||||||
|
test("current answers have more questions/answers than previous => resets fields", () => {
|
||||||
|
// Arrange
|
||||||
|
const previousMoldingQuestionAnswers = [{ partNum: "I'M A PART2!" }, { partNum: "I'M A PART!" }];;
|
||||||
|
const currentMoldingQuestionAnswers = [{ partNum: "I'M A PART!" }, { partNum: "I'M A PART3!" }, { partNum: "I'M A PART2!" }];
|
||||||
|
|
||||||
|
actions.saveMoldingQuestionAnswers(context, previousMoldingQuestionAnswers);
|
||||||
|
jest.clearAllMocks();
|
||||||
|
|
||||||
|
// Act
|
||||||
|
actions.saveMoldingQuestionAnswers(context, currentMoldingQuestionAnswers);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
testMoldingQuestionAnswerDependenciesHaveBeenReset(context, true);
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe("saveCapabilityQuestionAnswers", () => {
|
describe("saveCapabilityQuestionAnswers", () => {
|
||||||
test.todo("saves capabilityQuestionAnswers")
|
let context;
|
||||||
|
beforeEach(() => {
|
||||||
|
jest.clearAllMocks();
|
||||||
|
mutations.resetState(state);
|
||||||
|
context = state;
|
||||||
|
context.commit = jest.fn().mockImplementation((storeMutation, value) => mutations[storeMutation](context, value));
|
||||||
|
context.getters = {
|
||||||
|
...getters,
|
||||||
|
damage: getters.damage(context)
|
||||||
|
};
|
||||||
|
})
|
||||||
|
|
||||||
test.todo("there are no previous answers => resets necessary fields")
|
function testCapabilityQuestionAnswerDependenciesHaveBeenReset(context, shouldAnswersBeReset) {
|
||||||
|
if (shouldAnswersBeReset) {
|
||||||
|
expect(context.commit).toBeCalledWith(storeMutations.UPDATE_GLASS_PARTS, null);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
expect(context.commit).not.toBeCalledWith(storeMutations.UPDATE_GLASS_PARTS, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// mix up the order to make sure sort is working
|
test("there are no previous answers => resets necessary fields", () => {
|
||||||
test.todo("previous answers match current answers => does not reset fields")
|
// Arrange
|
||||||
|
const previousCapabilityQuestionAnswers = [];
|
||||||
|
const currentCapabilityQuestionAnswers = [{ result: "DYNAMIC" }, { result: "STATIC" }, { result: "UNKNOWN" }];
|
||||||
|
|
||||||
test.todo("previous answers does not match current answers => resets necessary fields")
|
actions.saveCapabilityQuestionAnswers(context, previousCapabilityQuestionAnswers);
|
||||||
|
jest.clearAllMocks();
|
||||||
|
|
||||||
|
// Act
|
||||||
|
actions.saveCapabilityQuestionAnswers(context, currentCapabilityQuestionAnswers);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
testCapabilityQuestionAnswerDependenciesHaveBeenReset(context, true);
|
||||||
|
})
|
||||||
|
|
||||||
|
test("previous answers match current answers => does not reset fields", () => {
|
||||||
|
// Arrange
|
||||||
|
const previousCapabilityQuestionAnswers = [{ result: "STATIC" }, { result: "DYNAMIC" }, { result: "UNKNOWN" }];
|
||||||
|
const currentCapabilityQuestionAnswers = [{ result: "DYNAMIC" }, { result: "STATIC" }, { result: "UNKNOWN" }];
|
||||||
|
|
||||||
|
actions.saveCapabilityQuestionAnswers(context, previousCapabilityQuestionAnswers);
|
||||||
|
jest.clearAllMocks();
|
||||||
|
|
||||||
|
// Act
|
||||||
|
actions.saveCapabilityQuestionAnswers(context, currentCapabilityQuestionAnswers);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
testCapabilityQuestionAnswerDependenciesHaveBeenReset(context, false);
|
||||||
|
})
|
||||||
|
|
||||||
|
test("previous answers do not match current answers => resets necessary fields", () => {
|
||||||
|
// Arrange
|
||||||
|
const previousCapabilityQuestionAnswers = [{ result: "DYNAMIC" }, { result: "DYNAMIC" }, { result: "STATIC" }];
|
||||||
|
const currentCapabilityQuestionAnswers = [{ result: "STATIC" }, { result: "STATIC" }, { result: "DYNAMIC" }];
|
||||||
|
|
||||||
|
actions.saveCapabilityQuestionAnswers(context, previousCapabilityQuestionAnswers);
|
||||||
|
jest.clearAllMocks();
|
||||||
|
|
||||||
|
// Act
|
||||||
|
actions.saveCapabilityQuestionAnswers(context, currentCapabilityQuestionAnswers);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
testCapabilityQuestionAnswerDependenciesHaveBeenReset(context, true);
|
||||||
|
})
|
||||||
|
|
||||||
|
test("previous answers have more questions/answers than current => resets fields", () => {
|
||||||
|
// Arrange
|
||||||
|
const previousCapabilityQuestionAnswers = [{ result: "STATIC" }, { result: "DYNAMIC" }, { result: "UNKNOWN" }];
|
||||||
|
const currentCapabilityQuestionAnswers = [{ result: "DYNAMIC" }];
|
||||||
|
|
||||||
|
actions.saveCapabilityQuestionAnswers(context, previousCapabilityQuestionAnswers);
|
||||||
|
jest.clearAllMocks();
|
||||||
|
|
||||||
|
// Act
|
||||||
|
actions.saveCapabilityQuestionAnswers(context, currentCapabilityQuestionAnswers);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
testCapabilityQuestionAnswerDependenciesHaveBeenReset(context, true);
|
||||||
|
})
|
||||||
|
|
||||||
|
test("current answers have more questions/answers than previous => resets fields", () => {
|
||||||
|
// Arrange
|
||||||
|
const previousCapabilityQuestionAnswers = [{ result: "STATIC" }, { result: "UNKNOWN" }];
|
||||||
|
const currentCapabilityQuestionAnswers = [{ result: "DYNAMIC" }, { result: "STATIC" }, { result: "UNKNOWN" }];
|
||||||
|
actions.saveCapabilityQuestionAnswers(context, previousCapabilityQuestionAnswers);
|
||||||
|
jest.clearAllMocks();
|
||||||
|
|
||||||
|
// Act
|
||||||
|
actions.saveCapabilityQuestionAnswers(context, currentCapabilityQuestionAnswers);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
testCapabilityQuestionAnswerDependenciesHaveBeenReset(context, true);
|
||||||
|
})
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
describe("Getters", () => {
|
describe("Getters", () => {
|
||||||
it("Vehicle getter, should return vehicle data", () => {
|
it("Vehicle getter, should return vehicle data", () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue