Setting up test cases

This commit is contained in:
Michaela Brydon 2024-03-28 16:47:10 -04:00
parent 8def9a7d07
commit 51c1352a2c
2 changed files with 18 additions and 10 deletions

View file

@ -141,6 +141,8 @@ describe('cart-dropdown component', () => {
// Assert
expect(servicePackage.exists()).toBeTruthy();
});
test.todo('non service package cart items', () => { });
test.todo('recycle cart item label when isRecycle true for some cart item', () => { });
test('cart footer', () => {
// Arrange
const reference = '#cart-footer';
@ -180,6 +182,7 @@ describe('cart-dropdown component', () => {
// Assert
expect(salesTax.exists()).toBeTruthy();
});
// TODO remove
test('recycle fee when preset in supported items', () => {
// Arrange
const reference = '#recycle-fee-item';
@ -200,6 +203,7 @@ describe('cart-dropdown component', () => {
expect(wrapper.vm.recycleFeeCartItem).not.toBeNull();
expect(recycleFee.exists()).toBeTruthy();
});
// TODO remove
test('mobile fee when preset', () => {
// Arrange
const reference = '#mobile-fee-item';
@ -284,6 +288,8 @@ describe('cart-dropdown component', () => {
// Assert
expect(cartBasePrice.exists()).toBeFalsy();
});
test.todo('recycle cart item label when isRecycle false for all cart items', () => { });
// TODO remove
test('recycle fee when not in supported items', () => {
// Arrange
const reference = '#recycle-fee-item';
@ -302,6 +308,7 @@ describe('cart-dropdown component', () => {
expect(wrapper.vm.recycleFeeCartItem).toBeNull();
expect(recycleFee.exists()).toBeFalsy();
});
// TODO remove
test('mobile fee when not in supported items', () => {
// Arrange
const reference = '#mobile-fee-item';
@ -323,6 +330,7 @@ describe('cart-dropdown component', () => {
});
});
describe('computed', () => {
// TODO remove
describe('showDeductibleLineItem', () => {
test.each([[true], [false]])('returns false when isNoComp true', (isItac) => {
// Arrange
@ -512,12 +520,9 @@ describe('cart-dropdown component', () => {
// TODO when subTotal and salesTax are finished
});
});
describe('subTotal', () => {
// TODO when method implemented
});
describe('salesTax', () => {
// TODO when method implemented
describe.todo('subTotal', () => {
});
describe.todo('salesTax', () => {});
describe('availableLineItems', () => {
test('returns expected when glassParts null', async () => {
// Arrange
@ -831,6 +836,7 @@ describe('cart-dropdown component', () => {
}));
});
});
describe.todo('nonServicePackageCartItems', () => {});
describe('servicePackageLabelWidget', () => {
test.each([
[null],

View file

@ -23,7 +23,7 @@
id="cart-deductible-or-base-price"
class="cart-item cart-gray">
<div
v-if="!useMainStore().isNoComp && !useMainStore().policy.isITAC"
v-if="!isNoComp && !isITAC"
id="cart-deductible"
class="d-flex justify-content-between align-items-center">
<span id="deductible-label">{{ deductibleLabel }}</span>
@ -177,6 +177,8 @@ export default {
const { supportingItems, glassParts, otherParts, vaps } = useMainStore().lineItems;
return {
isNoComp: useMainStore().isNoComp,
isITAC: useMainStore().policy.isITAC,
isRepair,
glassToReplace: glassToReplace ?? [],
vapsInOrder: vaps ?? [],
@ -205,11 +207,11 @@ export default {
return getPriceOfLineItems(this.baseServiceLineItems);
},
isUnverified() {
return !useMainStore().isNoComp && !useMainStore().policy.isITAC
return !this.isNoComp && !this.isITAC
&& (this.deductible == null || !useMainStore().isVerifiedCoverageStatus);
},
subTotal() {
const basePrice = !useMainStore().isNoComp && !useMainStore().policy.isITAC
const basePrice = !this.isNoComp && !this.isITAC
? this.deductible
: this.baseServicePrice;
const nonPackageCartItemsPrice = this.nonServicePackageCartItems.reduce(
@ -370,8 +372,8 @@ export default {
getDisplayed(amount, canBeVerifyingCoverage = true) {
return canBeVerifyingCoverage
&& this.isUnverified
&& !useMainStore().isNoComp
&& !useMainStore().policy.isITAC
&& !this.isNoComp
&& !this.isITAC
? VERIFYING_COVERAGE
: formatAmountInDollars(amount);
},