CSR-110: increase code coverage in unit tests

This commit is contained in:
Adam Caouette 2022-07-27 09:59:39 -04:00
parent b53479dbf1
commit b41042cee8
2 changed files with 129 additions and 40 deletions

View file

@ -13,6 +13,7 @@ module.exports = {
"!src/helpers/unit-test-helper.js",
"!src/layouts/vehicle-damage/windshield-options/windshield-options.vue",
"!src/layouts/molding-questions/**/*.vue",
"!src/layouts/capability-questions/**/*.vue",
"!src/layouts/part-questions/**/*.vue",
"!src/layouts/reveal/**/*.vue",
"!src/ux-components/text-link/**/*.vue",

View file

@ -94,7 +94,7 @@ describe("vin-pages-mixin", () => {
"description": "driver side, front",
"color": "Green Tint",
"requiresRecalibration": false,
"requiresCapabilityQuestions": false,
"requiresCapabilityQuestions": true,
"childParts": null
}
],
@ -109,7 +109,7 @@ describe("vin-pages-mixin", () => {
"description": "driver side, 1 hole",
"color": "Green Tint",
"requiresRecalibration": false,
"requiresCapabilityQuestions": false,
"requiresCapabilityQuestions": true,
"childParts": null
}
],
@ -147,7 +147,7 @@ describe("vin-pages-mixin", () => {
"description": "heated glass, stationary",
"color": "Green Tint",
"requiresRecalibration": false,
"requiresCapabilityQuestions": false,
"requiresCapabilityQuestions": true,
"childParts": null
}
],
@ -202,7 +202,7 @@ describe("vin-pages-mixin", () => {
"description": "driver side, front",
"color": "Green Tint",
"requiresRecalibration": false,
"requiresCapabilityQuestions": false,
"requiresCapabilityQuestions": true,
"childParts": null
}
],
@ -217,7 +217,7 @@ describe("vin-pages-mixin", () => {
"description": "driver side, 1 hole",
"color": "Green Tint",
"requiresRecalibration": false,
"requiresCapabilityQuestions": false,
"requiresCapabilityQuestions": true,
"childParts": null
}
],
@ -232,7 +232,7 @@ describe("vin-pages-mixin", () => {
"description": "driver side, body side, 1 hole",
"color": "Green Tint",
"requiresRecalibration": false,
"requiresCapabilityQuestions": false,
"requiresCapabilityQuestions": true,
"childParts": null
}
],
@ -247,7 +247,7 @@ describe("vin-pages-mixin", () => {
"description": "heated glass, stationary",
"color": "Green Tint",
"requiresRecalibration": false,
"requiresCapabilityQuestions": false,
"requiresCapabilityQuestions": true,
"childParts": null
}
],
@ -302,7 +302,7 @@ describe("vin-pages-mixin", () => {
"description": "driver side, front",
"color": "Green Tint",
"requiresRecalibration": false,
"requiresCapabilityQuestions": false,
"requiresCapabilityQuestions": true,
"childParts": null
}
],
@ -317,7 +317,7 @@ describe("vin-pages-mixin", () => {
"description": "driver side, 1 hole",
"color": "Green Tint",
"requiresRecalibration": false,
"requiresCapabilityQuestions": false,
"requiresCapabilityQuestions": true,
"childParts": null
},
{
@ -325,7 +325,7 @@ describe("vin-pages-mixin", () => {
"description": "driver side, 1 hole",
"color": "Gray Tint Privacy",
"requiresRecalibration": false,
"requiresCapabilityQuestions": false,
"requiresCapabilityQuestions": true,
"childParts": null
}
],
@ -340,7 +340,7 @@ describe("vin-pages-mixin", () => {
"description": "driver side, body side, 1 hole",
"color": "Green Tint",
"requiresRecalibration": false,
"requiresCapabilityQuestions": false,
"requiresCapabilityQuestions": true,
"childParts": null
},
{
@ -348,7 +348,7 @@ describe("vin-pages-mixin", () => {
"description": "driver side, body side, 1 hole",
"color": "Gray Tint Privacy",
"requiresRecalibration": false,
"requiresCapabilityQuestions": false,
"requiresCapabilityQuestions": true,
"childParts": null
}
],
@ -363,7 +363,7 @@ describe("vin-pages-mixin", () => {
"description": "heated glass, stationary",
"color": "Green Tint",
"requiresRecalibration": false,
"requiresCapabilityQuestions": false,
"requiresCapabilityQuestions": true,
"childParts": null
},
{
@ -371,7 +371,7 @@ describe("vin-pages-mixin", () => {
"description": "heated glass, stationary",
"color": "Gray Tint Privacy",
"requiresRecalibration": false,
"requiresCapabilityQuestions": false,
"requiresCapabilityQuestions": true,
"childParts": null
},
{
@ -379,7 +379,7 @@ describe("vin-pages-mixin", () => {
"description": "stationary",
"color": "Green Tint",
"requiresRecalibration": false,
"requiresCapabilityQuestions": false,
"requiresCapabilityQuestions": true,
"childParts": null
},
{
@ -387,7 +387,7 @@ describe("vin-pages-mixin", () => {
"description": "heated glass, movable, 8 hole",
"color": "Green Tint",
"requiresRecalibration": false,
"requiresCapabilityQuestions": false,
"requiresCapabilityQuestions": true,
"childParts": null
},
{
@ -395,7 +395,7 @@ describe("vin-pages-mixin", () => {
"description": "heated glass, movable, 8 hole",
"color": "Gray Tint Privacy",
"requiresRecalibration": false,
"requiresCapabilityQuestions": false,
"requiresCapabilityQuestions": true,
"childParts": null
}
],
@ -429,7 +429,7 @@ describe("vin-pages-mixin", () => {
"description": "heated glass, solar, antenna",
"color": "Green Tint",
"requiresRecalibration": false,
"requiresCapabilityQuestions": false,
"requiresCapabilityQuestions": true,
"childParts": null
},
{
@ -437,7 +437,7 @@ describe("vin-pages-mixin", () => {
"description": "heated glass, solar, antenna, w/diversity antenna",
"color": "Green Tint",
"requiresRecalibration": false,
"requiresCapabilityQuestions": false,
"requiresCapabilityQuestions": true,
"childParts": null
}
],
@ -469,7 +469,7 @@ describe("vin-pages-mixin", () => {
"description": "solar, 3rd visor band",
"color": "Green Tint",
"requiresRecalibration": false,
"requiresCapabilityQuestions": false,
"requiresCapabilityQuestions": true,
"childParts": [
{
"partNumber": "MWF03647",
@ -490,7 +490,7 @@ describe("vin-pages-mixin", () => {
"description": "solar, driver side, rear, ex models and above",
"color": "Green Tint",
"requiresRecalibration": false,
"requiresCapabilityQuestions": false,
"requiresCapabilityQuestions": true,
"childParts": null
}
],
@ -505,7 +505,7 @@ describe("vin-pages-mixin", () => {
"description": "solar, driver side, front, ex models and above",
"color": "Green Tint",
"requiresRecalibration": false,
"requiresCapabilityQuestions": false,
"requiresCapabilityQuestions": true,
"childParts": null
}
],
@ -520,7 +520,7 @@ describe("vin-pages-mixin", () => {
"description": "solar, driver side, rear",
"color": "Green Tint",
"requiresRecalibration": false,
"requiresCapabilityQuestions": false,
"requiresCapabilityQuestions": true,
"childParts": null
}
],
@ -535,7 +535,7 @@ describe("vin-pages-mixin", () => {
"description": "heated glass, solar, antenna",
"color": "Green Tint",
"requiresRecalibration": false,
"requiresCapabilityQuestions": false,
"requiresCapabilityQuestions": true,
"childParts": null
},
{
@ -543,7 +543,7 @@ describe("vin-pages-mixin", () => {
"description": "heated glass, solar, antenna, w/diversity antenna",
"color": "Green Tint",
"requiresRecalibration": false,
"requiresCapabilityQuestions": false,
"requiresCapabilityQuestions": true,
"childParts": null
}
],
@ -575,7 +575,7 @@ describe("vin-pages-mixin", () => {
"description": "solar",
"color": "Green Tint",
"requiresRecalibration": false,
"requiresCapabilityQuestions": false,
"requiresCapabilityQuestions": true,
"childParts": null
}
],
@ -590,7 +590,7 @@ describe("vin-pages-mixin", () => {
"description": "solar, driver side, rear",
"color": "Green Tint",
"requiresRecalibration": false,
"requiresCapabilityQuestions": false,
"requiresCapabilityQuestions": true,
"childParts": null
},
{
@ -598,7 +598,7 @@ describe("vin-pages-mixin", () => {
"description": "solar, driver side, rear",
"color": "Gray Tint Privacy",
"requiresRecalibration": false,
"requiresCapabilityQuestions": false,
"requiresCapabilityQuestions": true,
"childParts": null
}
],
@ -613,7 +613,7 @@ describe("vin-pages-mixin", () => {
"description": "solar, driver side, front",
"color": "Green Tint",
"requiresRecalibration": false,
"requiresCapabilityQuestions": false,
"requiresCapabilityQuestions": true,
"childParts": null
},
{
@ -621,7 +621,7 @@ describe("vin-pages-mixin", () => {
"description": "solar, driver side, front, laminated, soundproofing",
"color": "Green Tint",
"requiresRecalibration": false,
"requiresCapabilityQuestions": false,
"requiresCapabilityQuestions": true,
"childParts": null
}
],
@ -636,7 +636,7 @@ describe("vin-pages-mixin", () => {
"description": "solar, driver side, encap",
"color": "Green Tint",
"requiresRecalibration": false,
"requiresCapabilityQuestions": false,
"requiresCapabilityQuestions": true,
"childParts": null
},
{
@ -644,7 +644,7 @@ describe("vin-pages-mixin", () => {
"description": "solar, driver side, encap",
"color": "Gray Tint Privacy",
"requiresRecalibration": false,
"requiresCapabilityQuestions": false,
"requiresCapabilityQuestions": true,
"childParts": null
},
{
@ -652,7 +652,7 @@ describe("vin-pages-mixin", () => {
"description": "solar, antenna, driver side, encap",
"color": "Green Tint",
"requiresRecalibration": false,
"requiresCapabilityQuestions": false,
"requiresCapabilityQuestions": true,
"childParts": null
},
{
@ -660,7 +660,7 @@ describe("vin-pages-mixin", () => {
"description": "solar, antenna, driver side, encap",
"color": "Gray Tint Privacy",
"requiresRecalibration": false,
"requiresCapabilityQuestions": false,
"requiresCapabilityQuestions": true,
"childParts": null
},
{
@ -668,7 +668,7 @@ describe("vin-pages-mixin", () => {
"description": "solar, driver side, encap, chrome molding",
"color": "Green Tint",
"requiresRecalibration": false,
"requiresCapabilityQuestions": false,
"requiresCapabilityQuestions": true,
"childParts": null
},
{
@ -676,7 +676,7 @@ describe("vin-pages-mixin", () => {
"description": "solar, driver side, encap, chrome molding",
"color": "Gray Tint Privacy",
"requiresRecalibration": false,
"requiresCapabilityQuestions": false,
"requiresCapabilityQuestions": true,
"childParts": null
},
{
@ -684,7 +684,7 @@ describe("vin-pages-mixin", () => {
"description": "solar, antenna, driver side, encap, chrome molding",
"color": "Green Tint",
"requiresRecalibration": false,
"requiresCapabilityQuestions": false,
"requiresCapabilityQuestions": true,
"childParts": null
},
{
@ -692,7 +692,7 @@ describe("vin-pages-mixin", () => {
"description": "solar, antenna, driver side, encap, chrome molding",
"color": "Gray Tint Privacy",
"requiresRecalibration": false,
"requiresCapabilityQuestions": false,
"requiresCapabilityQuestions": true,
"childParts": null
}
],
@ -707,7 +707,7 @@ describe("vin-pages-mixin", () => {
"description": "heated glass, solar, 1 hole",
"color": "Green Tint",
"requiresRecalibration": false,
"requiresCapabilityQuestions": false,
"requiresCapabilityQuestions": true,
"childParts": null
},
{
@ -715,7 +715,7 @@ describe("vin-pages-mixin", () => {
"description": "heated glass, solar, 1 hole",
"color": "Gray Tint Privacy",
"requiresRecalibration": false,
"requiresCapabilityQuestions": false,
"requiresCapabilityQuestions": true,
"childParts": null
}
],
@ -736,6 +736,94 @@ describe("vin-pages-mixin", () => {
});
});
describe("should go to molding-questions", () => {
test("single glass location has child part questions => go to molding-questions", async () => {
// Arrange
const partsOrQuestions = [
{
"glassName": "Stationary",
"glassLocation": "Rear",
"parts": [
{
"partNumber": "FB25724GTYN",
"description": "heated glass, solar, antenna",
"color": "Green Tint",
"requiresRecalibration": false,
"requiresCapabilityQuestions": true,
"childParts": null,
"childPartQuestions": [
{
"questionSequence": 1,
"questionText": "Does the rubber seal around your windshield have a chrome strip running through it?",
"answers": [
{
"answerResult": "WKT D1106 C",
"answerText": "Yes",
"nextQuestionSequence": null
},
{
"answerResult": "WKT D1106 B",
"answerText": "No",
"nextQuestionSequence": null
}
]
}
]
}
],
"partQuestions": null
}
];
const { wrapper } = setupMocks({
partsOrQuestions: partsOrQuestions
});
// Act
await wrapper.vm.navigateForwardWithSingleCarMatch();
// Assert
expect(wrapper.vm.$router.navigate).toHaveBeenCalledTimes(1);
expect(wrapper.vm.$router.navigate).toHaveBeenCalledWith(navigationScenarios.SELECTED_VIN_WITH_MOLDING_QUESTIONS, wrapper.vm.$route, {}, {}, { partsOrQuestions });
});
});
describe("should go to capability-questions", () => {
test("single glass location has no child part questions but requiresCapabilityQuestions is true => go to capability-questions", async () => {
// Arrange
const partsOrQuestions = [
{
"glassName": "Stationary",
"glassLocation": "Rear",
"parts": [
{
"partNumber": "FB25724GTYN",
"description": "heated glass, solar, antenna",
"color": "Green Tint",
"requiresRecalibration": false,
"requiresCapabilityQuestions": true,
"childParts": null,
"childPartQuestions": null
}
],
"partQuestions": null
}
];
const { wrapper } = setupMocks({
partsOrQuestions: partsOrQuestions
});
// Act
await wrapper.vm.navigateForwardWithSingleCarMatch();
// Assert
expect(wrapper.vm.$router.navigate).toHaveBeenCalledTimes(1);
expect(wrapper.vm.$router.navigate).toHaveBeenCalledWith(navigationScenarios.SELECTED_VIN_WITH_CAPABILITY_QUESTIONS, wrapper.vm.$route, {}, {}, { partsOrQuestions });
});
});
describe("should go to heritage funnel", () => {
test("single glass location selected, has no part questions and has one part => go to heritage funnel", async () => {
// Arrange