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

View file

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