partial test addition
This commit is contained in:
parent
653cb5e9ca
commit
5133bf5697
2 changed files with 37 additions and 10 deletions
|
|
@ -458,6 +458,13 @@ describe('cart-dropdown component', () => {
|
|||
});
|
||||
});
|
||||
describe.todo('subTotal', () => {
|
||||
test('when not no comp and not itac, includes deductible price', () => {});
|
||||
test('when no comp, includes base service price', () => {});
|
||||
test('when ITAC, includes base service price', () => {});
|
||||
test('no issue when nonServicePackageCartItems null', () => {});
|
||||
test('when nonServicePackageCartItems non empty, sums appropriately', () => {});
|
||||
test('when deductible included, sums all prices appropriately', () => {});
|
||||
test('when base service price included, sums all prices appropriately', () => {});
|
||||
});
|
||||
describe.todo('salesTax', () => {});
|
||||
describe('availableLineItems', () => {
|
||||
|
|
@ -773,7 +780,18 @@ describe('cart-dropdown component', () => {
|
|||
}));
|
||||
});
|
||||
});
|
||||
describe.todo('nonServicePackageCartItems', () => {});
|
||||
describe.todo('nonServicePackageCartItems', () => {
|
||||
test('when recycleFee, includes recycle fee', () => {});
|
||||
test('when mobileFee, includes mobile fee', () => {});
|
||||
test('front wiper not included when front wiper in service package', () => {});
|
||||
test('rear wiper not included when rear wiper in service package', () => {});
|
||||
test('rain defense not included when rain defense in service package', () => {});
|
||||
test('front wiper included when not in service package and in vaps', () => {});
|
||||
test('rear wiper included when not in service package and in vaps', () => {});
|
||||
test('rain defense included when not in service package and in vaps', () => {});
|
||||
test('item in vaps outside front wiper, rear wiper, and rain defense never included', () => {});
|
||||
test('returns expected when multiple variables apply', () => {});
|
||||
});
|
||||
describe('servicePackageLabelWidget', () => {
|
||||
test.each([
|
||||
[null],
|
||||
|
|
@ -996,7 +1014,12 @@ describe('cart-dropdown component', () => {
|
|||
expect(result.name).toBe(expectedName);
|
||||
});
|
||||
});
|
||||
describe.todo('packagePrice', () => {});
|
||||
describe.todo('packagePrice', () => {
|
||||
test('returns 0 when servicePackageCartItems is null', () => {});
|
||||
test('returns 0 when servicePackageCartItems is empty', () => {});
|
||||
test('returns expected when servicePackageCartItems not empty', () => {});
|
||||
test('returns expected when servicePackageCartItems has one item', () => {});
|
||||
});
|
||||
});
|
||||
describe('method', () => {
|
||||
describe('getDisplayed', () => {
|
||||
|
|
@ -1353,8 +1376,10 @@ describe('cart-dropdown component', () => {
|
|||
expect(result.subTotal).toBe(expectedSubtotal);
|
||||
});
|
||||
});
|
||||
describe('removeItem', () => {
|
||||
// TODO when written
|
||||
describe.todo('removeItem', () => {
|
||||
test('when isVap false, updateVaps not called', () => {});
|
||||
test('when isVap true, vapsInOrder is expected', () => {});
|
||||
test('when isVap true and vapsInOrder null, vapsInOrder becomes []', () => {});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -214,10 +214,10 @@ export default {
|
|||
const basePrice = !this.isNoComp && !this.isITAC
|
||||
? this.deductible
|
||||
: this.baseServicePrice;
|
||||
const nonPackageCartItemsPrice = this.nonServicePackageCartItems.reduce(
|
||||
const nonPackageCartItemsPrice = this.nonServicePackageCartItems?.reduce(
|
||||
(accumulator, cartItem) => accumulator + cartItem.subTotal,
|
||||
0
|
||||
);
|
||||
) ?? 0;
|
||||
return basePrice + nonPackageCartItemsPrice + this.packagePrice;
|
||||
},
|
||||
salesTax() {
|
||||
|
|
@ -266,7 +266,9 @@ export default {
|
|||
return items;
|
||||
},
|
||||
nonServicePackageCartItems() {
|
||||
const vapsLineItemsNotInPackage = this.vapsInOrder.filter((vap) => !this.partTypesInServicePackage.includes(vap.partType));
|
||||
const vapsLineItemsNotInPackage = this.vapsInOrder
|
||||
?.filter((vap) => !this.partTypesInServicePackage.includes(vap.partType))
|
||||
?? [];
|
||||
const vapsCartItemsNotInPackage = vapsLineItemsNotInPackage.map((lineItem) => {
|
||||
switch (lineItem.partType) {
|
||||
case partTypeStrings.FRONT_WIPER:
|
||||
|
|
@ -298,10 +300,10 @@ export default {
|
|||
return this.getCartItemForVapsPart(partTypeStrings.RAIN_DEFENSE);
|
||||
},
|
||||
packagePrice() {
|
||||
return this.servicePackageCartItems.reduce(
|
||||
return this.servicePackageCartItems?.reduce(
|
||||
(accumulator, cartItem) => accumulator + cartItem.subTotal,
|
||||
0
|
||||
);
|
||||
) ?? 0;
|
||||
},
|
||||
amountDueLabel() {
|
||||
return this.getCmsContent(this.widget.amountDue, widgetFields.TEXT_BLOCK_WIDGET.TEXT);
|
||||
|
|
@ -405,7 +407,7 @@ export default {
|
|||
},
|
||||
removeItem(partType, isVap) {
|
||||
if (isVap) {
|
||||
this.vapsInOrder = this.vapsInOrder.filter((vap) => vap.partType !== partType);
|
||||
this.vapsInOrder = this.vapsInOrder?.filter((vap) => vap?.partType !== partType) ?? [];
|
||||
useMainStore().updateVaps(this.vapsInOrder);
|
||||
}
|
||||
// NOTE Currently only vaps can be removed
|
||||
|
|
|
|||
Loading…
Reference in a new issue