CSR-1582 | Unit tests and formatting
This commit is contained in:
parent
82a73565bd
commit
b54fafb929
1 changed files with 16 additions and 100 deletions
|
|
@ -135,64 +135,9 @@ describe("service-package-question.vue", () => {
|
||||||
expectedModifiedAnswers[packageNameKey].tierThree
|
expectedModifiedAnswers[packageNameKey].tierThree
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
it("should not select a default package if ANY glass part or supporting item has no prices", async () => {
|
it("should not select a default package if isInsurance is null", async () => {
|
||||||
// Note, only the first WSREPAIR item has a 0 for laborAmount, this is enough to not try and select a default package
|
// Note, only the first WSREPAIR item has a 0 for laborAmount, this is enough to not try and select a default package
|
||||||
const wrapper = setupMocks({
|
const wrapper = setupMocks({});
|
||||||
mountOptionsMockData: {
|
|
||||||
store: {
|
|
||||||
getters: {
|
|
||||||
lineItems: {
|
|
||||||
glassParts: [
|
|
||||||
{
|
|
||||||
partNumber: "FW02627GBYNOEE",
|
|
||||||
description: "solar, 3rd visor band",
|
|
||||||
color: "Green Tint, Blue Shade",
|
|
||||||
partType: "WINDSHIELD",
|
|
||||||
canSafeliteRecalibrate: false,
|
|
||||||
requiresRecalibration: false,
|
|
||||||
requiresCapabilityQuestions: false,
|
|
||||||
recalibrationType: null,
|
|
||||||
childParts: null,
|
|
||||||
laborAmount: 5.0,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
supportingItems: [
|
|
||||||
{
|
|
||||||
partNumber: "SUPPLIES-REPAIR",
|
|
||||||
description: null,
|
|
||||||
partType: "REPAIR FEE",
|
|
||||||
laborAmount: 5.0,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
partNumber: "WSREPAIR",
|
|
||||||
description: null,
|
|
||||||
partType: "REPAIR FEE",
|
|
||||||
laborAmount: 0,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
partNumber: "WSREPAIR",
|
|
||||||
description: null,
|
|
||||||
partType: "REPAIR FEE",
|
|
||||||
laborAmount: 5.0,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
partNumber: "WSREPAIR",
|
|
||||||
description: null,
|
|
||||||
partType: "REPAIR FEE",
|
|
||||||
laborAmount: 5.0,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
order: {
|
|
||||||
damage: {
|
|
||||||
isRepair: false,
|
|
||||||
glassToReplace: [{ glassLocation: "Windshield" }],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
wrapper.setProps({ availableLineItems: null });
|
wrapper.setProps({ availableLineItems: null });
|
||||||
|
|
@ -202,59 +147,24 @@ describe("service-package-question.vue", () => {
|
||||||
// Assert
|
// Assert
|
||||||
expect(wrapper.vm.selectedPackageName).toBe(null);
|
expect(wrapper.vm.selectedPackageName).toBe(null);
|
||||||
});
|
});
|
||||||
it("should select a default package if ALL glass parts and supporting items have prices", async () => {
|
it("should select a default package if isInsurance is NOT null", async () => {
|
||||||
const wrapper = setupMocks({
|
const wrapper = setupMocks({
|
||||||
mountOptionsMockData: {
|
mountOptionsMockData: {
|
||||||
store: {
|
store: {
|
||||||
getters: {
|
getters: {
|
||||||
lineItems: {
|
|
||||||
glassParts: [
|
|
||||||
{
|
|
||||||
partNumber: "FW02627GBYNOEE",
|
|
||||||
description: "solar, 3rd visor band",
|
|
||||||
color: "Green Tint, Blue Shade",
|
|
||||||
partType: "WINDSHIELD",
|
|
||||||
canSafeliteRecalibrate: false,
|
|
||||||
requiresRecalibration: false,
|
|
||||||
requiresCapabilityQuestions: false,
|
|
||||||
recalibrationType: null,
|
|
||||||
childParts: null,
|
|
||||||
laborAmount: 5.0,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
supportingItems: [
|
|
||||||
{
|
|
||||||
partNumber: "SUPPLIES-REPAIR",
|
|
||||||
description: null,
|
|
||||||
partType: "REPAIR FEE",
|
|
||||||
laborAmount: 5.0,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
partNumber: "WSREPAIR",
|
|
||||||
description: null,
|
|
||||||
partType: "REPAIR FEE",
|
|
||||||
laborAmount: 5.0,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
partNumber: "WSREPAIR",
|
|
||||||
description: null,
|
|
||||||
partType: "REPAIR FEE",
|
|
||||||
laborAmount: 5.0,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
partNumber: "WSREPAIR",
|
|
||||||
description: null,
|
|
||||||
partType: "REPAIR FEE",
|
|
||||||
laborAmount: 5.0,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
order: {
|
order: {
|
||||||
damage: {
|
damage: {
|
||||||
isRepair: false,
|
isRepair: false,
|
||||||
glassToReplace: [{ glassLocation: "Windshield" }],
|
glassToReplace: [{ glassLocation: "Windshield" }],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
lineItems: {
|
||||||
|
vaps: [],
|
||||||
|
},
|
||||||
|
hasAnyNonWindshieldGlassParts: false,
|
||||||
|
payment: {
|
||||||
|
isInsurance: false,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
@ -329,6 +239,9 @@ describe("service-package-question.vue", () => {
|
||||||
glassToReplace: [{ glassLocation: "Windshield" }],
|
glassToReplace: [{ glassLocation: "Windshield" }],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
payment: {
|
||||||
|
isInsurance: false,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
@ -758,6 +671,9 @@ function setupMocks({ mountOptionsMockData, props = mockProps }) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
hasAnyNonWindshieldGlassParts: false,
|
hasAnyNonWindshieldGlassParts: false,
|
||||||
|
payment: {
|
||||||
|
isInsurance: null,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue