Fixing existing tests
This commit is contained in:
parent
1caf0e738c
commit
49aad2c509
4 changed files with 121 additions and 96 deletions
|
|
@ -4,7 +4,10 @@ exports[`cart-dropdown component initial data rendered as expected 1`] = `
|
||||||
Object {
|
Object {
|
||||||
"baseServiceLineItems": Array [],
|
"baseServiceLineItems": Array [],
|
||||||
"deductible": null,
|
"deductible": null,
|
||||||
"isExpanded": false,
|
"glassToReplace": Array [],
|
||||||
|
"isExpanded": true,
|
||||||
|
"isRepair": null,
|
||||||
|
"vapsInOrder": Array [],
|
||||||
"widget": Object {
|
"widget": Object {
|
||||||
"amountDue": "AmountDueTextWidget",
|
"amountDue": "AmountDueTextWidget",
|
||||||
"basePrice": "BasePriceWidget",
|
"basePrice": "BasePriceWidget",
|
||||||
|
|
@ -12,6 +15,7 @@ Object {
|
||||||
"mobileFee": "MobileServiceWidget",
|
"mobileFee": "MobileServiceWidget",
|
||||||
"recycleFee": "RecycleFeeWidget",
|
"recycleFee": "RecycleFeeWidget",
|
||||||
"salesTax": "SalesTaxWidget",
|
"salesTax": "SalesTaxWidget",
|
||||||
|
"servicePackage": "ServicePackageTitle",
|
||||||
"subtotal": "SubtotalWidget",
|
"subtotal": "SubtotalWidget",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -161,6 +161,45 @@ describe('cart-dropdown component', () => {
|
||||||
// Assert
|
// Assert
|
||||||
expect(salesTax.exists()).toBeTruthy();
|
expect(salesTax.exists()).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
test('recycle fee when preset in supported items', () => {
|
||||||
|
// Arrange
|
||||||
|
const reference = '#recycle-fee-item';
|
||||||
|
const { wrapper } = getMountedComponent({
|
||||||
|
order: {
|
||||||
|
lineItems: {
|
||||||
|
supportingItems: [{
|
||||||
|
partType: partTypeStrings.REPLACE_FEE
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Act
|
||||||
|
const recycleFee = wrapper.find(reference);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(wrapper.vm.recycleFeeCartItem).not.toBeNull();
|
||||||
|
expect(recycleFee.exists()).toBeTruthy();
|
||||||
|
});
|
||||||
|
test('mobile fee when preset', () => {
|
||||||
|
// Arrange
|
||||||
|
const reference = '#mobile-fee-item';
|
||||||
|
const { wrapper } = getMountedComponent({
|
||||||
|
order: {
|
||||||
|
lineItems: {
|
||||||
|
supportingItems: [],
|
||||||
|
mobileFee: {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Act
|
||||||
|
const mobileFee = wrapper.find(reference);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(wrapper.vm.mobileFeeCartItem).not.toBeNull();
|
||||||
|
expect(mobileFee.exists()).toBeTruthy();
|
||||||
|
});
|
||||||
test('bottom amount due', () => {
|
test('bottom amount due', () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const reference = '#bottom-amount-due';
|
const reference = '#bottom-amount-due';
|
||||||
|
|
@ -174,6 +213,25 @@ describe('cart-dropdown component', () => {
|
||||||
// Assert
|
// Assert
|
||||||
expect(bottomAmountDue.exists()).toBeTruthy();
|
expect(bottomAmountDue.exists()).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
test('Hides recycle fee when not in supported items', () => {
|
||||||
|
// Arrange
|
||||||
|
const reference = '#mobile-fee-item';
|
||||||
|
const { wrapper } = getMountedComponent({
|
||||||
|
order: {
|
||||||
|
lineItems: {
|
||||||
|
supportingItems: [],
|
||||||
|
mobileFee: null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Act
|
||||||
|
const cartDeductible = wrapper.find(reference);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(wrapper.vm.mobileFeeCartItem).toBeNull();
|
||||||
|
expect(cartDeductible.exists()).toBeFalsy();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
describe('does not display', () => {
|
describe('does not display', () => {
|
||||||
test('cart deductible when showDeductibleLineItem is false', () => {
|
test('cart deductible when showDeductibleLineItem is false', () => {
|
||||||
|
|
@ -226,6 +284,43 @@ describe('cart-dropdown component', () => {
|
||||||
// Assert
|
// Assert
|
||||||
expect(cartBasePrice.exists()).toBeFalsy();
|
expect(cartBasePrice.exists()).toBeFalsy();
|
||||||
});
|
});
|
||||||
|
test('recycle fee when not in supported items', () => {
|
||||||
|
// Arrange
|
||||||
|
const reference = '#recycle-fee-item';
|
||||||
|
const { wrapper } = getMountedComponent({
|
||||||
|
order: {
|
||||||
|
lineItems: {
|
||||||
|
supportingItems: []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Act
|
||||||
|
const recycleFee = wrapper.find(reference);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(wrapper.vm.recycleFeeCartItem).toBeNull();
|
||||||
|
expect(recycleFee.exists()).toBeFalsy();
|
||||||
|
});
|
||||||
|
test('mobile fee when not in supported items', () => {
|
||||||
|
// Arrange
|
||||||
|
const reference = '#mobile-fee-item';
|
||||||
|
const { wrapper } = getMountedComponent({
|
||||||
|
order: {
|
||||||
|
lineItems: {
|
||||||
|
supportingItems: [],
|
||||||
|
mobileFee: null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Act
|
||||||
|
const mobileFee = wrapper.find(reference);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(wrapper.vm.mobileFeeCartItem).toBeNull();
|
||||||
|
expect(mobileFee.exists()).toBeFalsy();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
describe('computed', () => {
|
describe('computed', () => {
|
||||||
describe('showDeductibleLineItem', () => {
|
describe('showDeductibleLineItem', () => {
|
||||||
|
|
@ -235,7 +330,7 @@ describe('cart-dropdown component', () => {
|
||||||
order: {
|
order: {
|
||||||
policy: {
|
policy: {
|
||||||
isITAC: isItac,
|
isITAC: isItac,
|
||||||
noCoverage: true,
|
noCoverage: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -297,7 +392,7 @@ describe('cart-dropdown component', () => {
|
||||||
order: {
|
order: {
|
||||||
policy: {
|
policy: {
|
||||||
isITAC: false,
|
isITAC: false,
|
||||||
noCoverage: true,
|
noCoverage: true
|
||||||
},
|
},
|
||||||
currentDeductible: null
|
currentDeductible: null
|
||||||
}
|
}
|
||||||
|
|
@ -549,85 +644,5 @@ describe('cart-dropdown component', () => {
|
||||||
expect(result).toBe(dollarAmount);
|
expect(result).toBe(dollarAmount);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
describe('Recyle fee', () => {
|
|
||||||
test('Shows recycle fee when preset in supported items', () => {
|
|
||||||
// Arrange
|
|
||||||
const reference = '#recycle-fee-item';
|
|
||||||
const { wrapper } = getMountedComponent({
|
|
||||||
order: {
|
|
||||||
lineItems: {
|
|
||||||
supportingItems: [{
|
|
||||||
partType: partTypeStrings.REPLACE_FEE
|
|
||||||
}]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Act
|
|
||||||
const cartDeductible = wrapper.find(reference);
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
expect(wrapper.vm.recycleFeeCartItem).not.toBeNull();
|
|
||||||
expect(cartDeductible.exists()).toBeTruthy();
|
|
||||||
});
|
|
||||||
test('Hides recycle fee when not in supported items', () => {
|
|
||||||
// Arrange
|
|
||||||
const reference = '#recycle-fee-item';
|
|
||||||
const { wrapper } = getMountedComponent({
|
|
||||||
order: {
|
|
||||||
lineItems: {
|
|
||||||
supportingItems: []
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Act
|
|
||||||
const cartDeductible = wrapper.find(reference);
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
expect(wrapper.vm.recycleFeeCartItem).toBeNull();
|
|
||||||
expect(cartDeductible.exists()).toBeFalsy();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
describe('Mobile Fee', () => {
|
|
||||||
test('Shows mobile fee when preset', () => {
|
|
||||||
// Arrange
|
|
||||||
const reference = '#mobile-fee-item';
|
|
||||||
const { wrapper } = getMountedComponent({
|
|
||||||
order: {
|
|
||||||
lineItems: {
|
|
||||||
supportingItems: [],
|
|
||||||
mobileFee: {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Act
|
|
||||||
const cartDeductible = wrapper.find(reference);
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
expect(wrapper.vm.mobileFeeCartItem).not.toBeNull();
|
|
||||||
expect(cartDeductible.exists()).toBeTruthy();
|
|
||||||
});
|
|
||||||
test('Hides recycle fee when not in supported items', () => {
|
|
||||||
// Arrange
|
|
||||||
const reference = '#mobile-fee-item';
|
|
||||||
const { wrapper } = getMountedComponent({
|
|
||||||
order: {
|
|
||||||
lineItems: {
|
|
||||||
supportingItems: [],
|
|
||||||
mobileFee: null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Act
|
|
||||||
const cartDeductible = wrapper.find(reference);
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
expect(wrapper.vm.mobileFeeCartItem).toBeNull();
|
|
||||||
expect(cartDeductible.exists()).toBeFalsy();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -231,7 +231,7 @@ export default {
|
||||||
return [
|
return [
|
||||||
...(glassParts ?? []),
|
...(glassParts ?? []),
|
||||||
...(supportingItems ?? []),
|
...(supportingItems ?? []),
|
||||||
...this.availableVaps
|
...(this.availableVaps ?? [])
|
||||||
];
|
];
|
||||||
},
|
},
|
||||||
servicePackageTier() {
|
servicePackageTier() {
|
||||||
|
|
@ -277,7 +277,7 @@ export default {
|
||||||
rainDefenseCartItem() {
|
rainDefenseCartItem() {
|
||||||
const rainDefenseLabel = this.getCmsContentForVapsType(partTypeStrings.RAIN_DEFENSE);
|
const rainDefenseLabel = this.getCmsContentForVapsType(partTypeStrings.RAIN_DEFENSE);
|
||||||
const rainDefenseLineItem = this.vapsInOrder
|
const rainDefenseLineItem = this.vapsInOrder
|
||||||
.find((vapsLineItem) => vapsLineItem.partType === partTypeStrings.RAIN_DEFENSE);
|
?.find((vapsLineItem) => vapsLineItem.partType === partTypeStrings.RAIN_DEFENSE);
|
||||||
return this.getCartItem(rainDefenseLabel, [rainDefenseLineItem]);
|
return this.getCartItem(rainDefenseLabel, [rainDefenseLineItem]);
|
||||||
},
|
},
|
||||||
packagePrice() {
|
packagePrice() {
|
||||||
|
|
@ -307,7 +307,6 @@ export default {
|
||||||
},
|
},
|
||||||
servicePackageLabelWidget() {
|
servicePackageLabelWidget() {
|
||||||
if (!this.servicePackageNames) {
|
if (!this.servicePackageNames) {
|
||||||
console.log('no service package names');
|
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
const currentPackage = this.servicePackageNames
|
const currentPackage = this.servicePackageNames
|
||||||
|
|
@ -316,16 +315,23 @@ export default {
|
||||||
return currentPackage.SubWidgetName ?? '';
|
return currentPackage.SubWidgetName ?? '';
|
||||||
},
|
},
|
||||||
recycleFeeCartItem() {
|
recycleFeeCartItem() {
|
||||||
return this.getCartItem(
|
const recycleFeeLineItem = useMainStore().lineItems.supportingItems
|
||||||
this.getCmsContent(this.widget.recycleFee, widgetFields.TEXT_BLOCK_WIDGET.TEXT),
|
?.find((lineItem) => lineItem.partType === partTypeStrings.REPLACE_FEE);
|
||||||
[useMainStore().lineItems.supportingItems.find((lineItem) => lineItem.partType === partTypeStrings.REPLACE_FEE)]
|
return recycleFeeLineItem
|
||||||
);
|
? this.getCartItem(
|
||||||
|
this.getCmsContent(this.widget.recycleFee, widgetFields.TEXT_BLOCK_WIDGET.TEXT),
|
||||||
|
[recycleFeeLineItem]
|
||||||
|
)
|
||||||
|
: null;
|
||||||
},
|
},
|
||||||
mobileFeeCartItem() {
|
mobileFeeCartItem() {
|
||||||
return this.getCartItem(
|
const mobileFeeLineItem = useMainStore().lineItems.mobileFee;
|
||||||
this.getCmsContent(this.widget.mobileFee, widgetFields.TEXT_BLOCK_WIDGET.TEXT),
|
return mobileFeeLineItem
|
||||||
[useMainStore().lineItems.mobileFee]
|
? this.getCartItem(
|
||||||
);
|
this.getCmsContent(this.widget.mobileFee, widgetFields.TEXT_BLOCK_WIDGET.TEXT),
|
||||||
|
[mobileFeeLineItem]
|
||||||
|
)
|
||||||
|
: null;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
@ -364,7 +370,7 @@ export default {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
const vapsTypeName = vapsItemDescriptions.find((entry) => entry.Name === vapsType);
|
const vapsTypeName = vapsItemDescriptions?.find((entry) => entry.Name === vapsType);
|
||||||
|
|
||||||
return vapsTypeName.Text;
|
return vapsTypeName.Text;
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -129,7 +129,7 @@ export default {
|
||||||
vm.setCmsContent(resultMap.cmsContent);
|
vm.setCmsContent(resultMap.cmsContent);
|
||||||
vm.updateFooterButtonText(vm.customCallToActionButtonCopy);
|
vm.updateFooterButtonText(vm.customCallToActionButtonCopy);
|
||||||
vm.$refs.reviewDropdown.initializeComponent(resultMap.reviewDropdownData);
|
vm.$refs.reviewDropdown.initializeComponent(resultMap.reviewDropdownData);
|
||||||
vm.setAvailableVaps(pricedVaps);
|
vm.setAvailableVaps(pricedVaps ?? []);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue