unit test fixes
This commit is contained in:
parent
e4cdc59bc9
commit
29d063290c
4 changed files with 166 additions and 20 deletions
|
|
@ -10,6 +10,7 @@ Object {
|
||||||
"isExpanded": false,
|
"isExpanded": false,
|
||||||
"widget": Object {
|
"widget": Object {
|
||||||
"amountDue": "AmountDueTextWidget",
|
"amountDue": "AmountDueTextWidget",
|
||||||
|
"amountPaid": "AmountPaidTextWidget",
|
||||||
"basePrice": "BasePriceWidget",
|
"basePrice": "BasePriceWidget",
|
||||||
"deductible": "DeductibleWidget",
|
"deductible": "DeductibleWidget",
|
||||||
"mobileFee": "MobileServiceWidget",
|
"mobileFee": "MobileServiceWidget",
|
||||||
|
|
|
||||||
|
|
@ -225,6 +225,27 @@ describe('cart-dropdown component', () => {
|
||||||
// Assert
|
// Assert
|
||||||
expect(salesTax.exists()).toBeTruthy();
|
expect(salesTax.exists()).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
test('amount paid when Pay in Advance', () => {
|
||||||
|
// Arrange
|
||||||
|
const reference = '#cart-amount-paid';
|
||||||
|
const isExpanded = true;
|
||||||
|
const showAsPaid = true;
|
||||||
|
const initialPropsData = { isExpanded, showAsPaid };
|
||||||
|
const storeData = {
|
||||||
|
order: {
|
||||||
|
payment: {
|
||||||
|
isPayInAdvance: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const { wrapper } = getMountedComponent(storeData, {}, initialPropsData);
|
||||||
|
|
||||||
|
// Act
|
||||||
|
const amountPaid = wrapper.find(reference);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(amountPaid.exists()).toBeTruthy();
|
||||||
|
});
|
||||||
test('bottom amount due', () => {
|
test('bottom amount due', () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const reference = '#bottom-amount-due';
|
const reference = '#bottom-amount-due';
|
||||||
|
|
@ -593,7 +614,13 @@ describe('cart-dropdown component', () => {
|
||||||
vaps: null
|
vaps: null
|
||||||
},
|
},
|
||||||
payment: {
|
payment: {
|
||||||
insuranceCoverage: { isVerified: true }
|
insuranceCoverage: {
|
||||||
|
coverageStatus: coverageStatuses.VERIFIED
|
||||||
|
}
|
||||||
|
},
|
||||||
|
policy: {
|
||||||
|
noCoverage: false,
|
||||||
|
isITAC: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
issConfig: {
|
issConfig: {
|
||||||
|
|
@ -629,7 +656,9 @@ describe('cart-dropdown component', () => {
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
payment: {
|
payment: {
|
||||||
insuranceCoverage: { isVerified: true }
|
insuranceCoverage: {
|
||||||
|
coverageStatus: coverageStatuses.VERIFIED
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
issConfig: {
|
issConfig: {
|
||||||
|
|
@ -1744,7 +1773,12 @@ describe('cart-dropdown component', () => {
|
||||||
isNoComp: false
|
isNoComp: false
|
||||||
},
|
},
|
||||||
currentDeductible: 321,
|
currentDeductible: 321,
|
||||||
policyLookupSuccessful: true
|
policyLookupSuccessful: true,
|
||||||
|
payment: {
|
||||||
|
insuranceCoverage: {
|
||||||
|
coverageStatus: coverageStatuses.VERIFIED
|
||||||
|
}
|
||||||
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const { wrapper } = getMountedComponent(storeData);
|
const { wrapper } = getMountedComponent(storeData);
|
||||||
|
|
|
||||||
|
|
@ -125,7 +125,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
v-if="showAsPaid"
|
v-if="showAsPaid"
|
||||||
id="amount-paid"
|
id="cart-amount-paid"
|
||||||
class="pt-1 col d-flex justify-content-between">
|
class="pt-1 col d-flex justify-content-between">
|
||||||
<span id="amount-paid-label">{{ amountPaidLabel }}</span>
|
<span id="amount-paid-label">{{ amountPaidLabel }}</span>
|
||||||
<span if="amount-paid-value">{{ getDisplayed(amountPaid) }}</span>
|
<span if="amount-paid-value">{{ getDisplayed(amountPaid) }}</span>
|
||||||
|
|
@ -224,12 +224,12 @@ export default {
|
||||||
baseServicePrice() {
|
baseServicePrice() {
|
||||||
return getPriceOfLineItems(this.baseServiceLineItems) ?? 0;
|
return getPriceOfLineItems(this.baseServiceLineItems) ?? 0;
|
||||||
},
|
},
|
||||||
isVerified() {
|
isVerifiedCoverageStatus() {
|
||||||
return this.submittedOrder ? this.submittedOrder.payment.isVerified : useMainStore().isVerifiedCoverageStatus;
|
return this.submittedOrder ? this.submittedOrder.payment.insuranceCoverage.isVerified : useMainStore().isVerifiedCoverageStatus;
|
||||||
},
|
},
|
||||||
isUnverified() {
|
isUnverified() {
|
||||||
return !this.isNoComp && !this.isITAC
|
return !this.isNoComp && !this.isITAC
|
||||||
&& (this.deductible == null || this.isUnverified);
|
&& (this.deductible == null || !this.isVerifiedCoverageStatus);
|
||||||
},
|
},
|
||||||
isITAC() {
|
isITAC() {
|
||||||
return this.submittedOrder ? this.submittedOrder.policy.isITAC : useMainStore().isITAC;
|
return this.submittedOrder ? this.submittedOrder.policy.isITAC : useMainStore().isITAC;
|
||||||
|
|
@ -268,7 +268,7 @@ export default {
|
||||||
|
|
||||||
let result = 0;
|
let result = 0;
|
||||||
|
|
||||||
if (this.isVerified) {
|
if (!this.isUnverified) {
|
||||||
if (this.isITAC || this.isNoComp) {
|
if (this.isITAC || this.isNoComp) {
|
||||||
result += sumTax(this.baseServiceLineItems);
|
result += sumTax(this.baseServiceLineItems);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,8 @@ jest.mock('@/helpers/layout-helper.js', () => jest.fn());
|
||||||
|
|
||||||
jest.mock('@/helpers/cms-content-helper', () => ({
|
jest.mock('@/helpers/cms-content-helper', () => ({
|
||||||
fetchCmsContentForPage: jest.fn(),
|
fetchCmsContentForPage: jest.fn(),
|
||||||
processIfStatements: jest.fn()
|
processIfStatements: jest.fn(),
|
||||||
|
splitCopyOnCMSPlaceHolder: jest.fn()
|
||||||
}));
|
}));
|
||||||
const wordingText = 'wording text {custom:address}';
|
const wordingText = 'wording text {custom:address}';
|
||||||
|
|
||||||
|
|
@ -105,7 +106,17 @@ const sessionStorage = {
|
||||||
zipCode: '12345'
|
zipCode: '12345'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
payment: {
|
||||||
|
isPayInAdvance: false
|
||||||
|
},
|
||||||
|
lineItems: {
|
||||||
|
vaps: []
|
||||||
|
},
|
||||||
|
policy: {
|
||||||
|
noCoverage: false
|
||||||
|
},
|
||||||
|
damage: {}
|
||||||
};
|
};
|
||||||
|
|
||||||
const sessionStorageMock = (() => {
|
const sessionStorageMock = (() => {
|
||||||
|
|
@ -302,7 +313,17 @@ describe('OrderConfirmation.vue', () => {
|
||||||
},
|
},
|
||||||
serviceLocation: {
|
serviceLocation: {
|
||||||
appointmentType: 'Mobile'
|
appointmentType: 'Mobile'
|
||||||
}
|
},
|
||||||
|
payment: {
|
||||||
|
isPayInAdvance: false
|
||||||
|
},
|
||||||
|
lineItems: {
|
||||||
|
vaps: []
|
||||||
|
},
|
||||||
|
policy: {
|
||||||
|
noCoverage: false
|
||||||
|
},
|
||||||
|
damage: {}
|
||||||
};
|
};
|
||||||
window.sessionStorage.setItem('submittedOrder', JSON.stringify(testSessionStorage));
|
window.sessionStorage.setItem('submittedOrder', JSON.stringify(testSessionStorage));
|
||||||
const { wrapper } = getMountedComponent();
|
const { wrapper } = getMountedComponent();
|
||||||
|
|
@ -331,7 +352,17 @@ describe('OrderConfirmation.vue', () => {
|
||||||
zipCode: '12345'
|
zipCode: '12345'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
payment: {
|
||||||
|
isPayInAdvance: false
|
||||||
|
},
|
||||||
|
lineItems: {
|
||||||
|
vaps: []
|
||||||
|
},
|
||||||
|
policy: {
|
||||||
|
noCoverage: false
|
||||||
|
},
|
||||||
|
damage: {}
|
||||||
};
|
};
|
||||||
window.sessionStorage.setItem('submittedOrder', JSON.stringify(testSessionStorage));
|
window.sessionStorage.setItem('submittedOrder', JSON.stringify(testSessionStorage));
|
||||||
const { wrapper } = getMountedComponent();
|
const { wrapper } = getMountedComponent();
|
||||||
|
|
@ -368,7 +399,17 @@ describe('OrderConfirmation.vue', () => {
|
||||||
state: 'AZ',
|
state: 'AZ',
|
||||||
zipCode: '12345',
|
zipCode: '12345',
|
||||||
appointmentType: 'Mobile'
|
appointmentType: 'Mobile'
|
||||||
}
|
},
|
||||||
|
payment: {
|
||||||
|
isPayInAdvance: false
|
||||||
|
},
|
||||||
|
lineItems: {
|
||||||
|
vaps: []
|
||||||
|
},
|
||||||
|
policy: {
|
||||||
|
noCoverage: false
|
||||||
|
},
|
||||||
|
damage: {}
|
||||||
};
|
};
|
||||||
window.sessionStorage.setItem('submittedOrder', JSON.stringify(testSessionStorage));
|
window.sessionStorage.setItem('submittedOrder', JSON.stringify(testSessionStorage));
|
||||||
const { wrapper } = getMountedComponent();
|
const { wrapper } = getMountedComponent();
|
||||||
|
|
@ -397,7 +438,17 @@ describe('OrderConfirmation.vue', () => {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
appointmentType: 'Dropoff'
|
appointmentType: 'Dropoff'
|
||||||
}
|
},
|
||||||
|
payment: {
|
||||||
|
isPayInAdvance: false
|
||||||
|
},
|
||||||
|
lineItems: {
|
||||||
|
vaps: []
|
||||||
|
},
|
||||||
|
policy: {
|
||||||
|
noCoverage: false
|
||||||
|
},
|
||||||
|
damage: {}
|
||||||
};
|
};
|
||||||
window.sessionStorage.setItem('submittedOrder', JSON.stringify(testSessionStorage));
|
window.sessionStorage.setItem('submittedOrder', JSON.stringify(testSessionStorage));
|
||||||
const { wrapper } = getMountedComponent();
|
const { wrapper } = getMountedComponent();
|
||||||
|
|
@ -426,7 +477,17 @@ describe('OrderConfirmation.vue', () => {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
appointmentType: 'Inshop'
|
appointmentType: 'Inshop'
|
||||||
}
|
},
|
||||||
|
payment: {
|
||||||
|
isPayInAdvance: false
|
||||||
|
},
|
||||||
|
lineItems: {
|
||||||
|
vaps: []
|
||||||
|
},
|
||||||
|
policy: {
|
||||||
|
noCoverage: false
|
||||||
|
},
|
||||||
|
damage: {}
|
||||||
};
|
};
|
||||||
window.sessionStorage.setItem('submittedOrder', JSON.stringify(testSessionStorage));
|
window.sessionStorage.setItem('submittedOrder', JSON.stringify(testSessionStorage));
|
||||||
const { wrapper } = getMountedComponent();
|
const { wrapper } = getMountedComponent();
|
||||||
|
|
@ -452,7 +513,17 @@ describe('OrderConfirmation.vue', () => {
|
||||||
state: 'AZ',
|
state: 'AZ',
|
||||||
zipCode: '12345',
|
zipCode: '12345',
|
||||||
appointmentType: 'Mobile'
|
appointmentType: 'Mobile'
|
||||||
}
|
},
|
||||||
|
payment: {
|
||||||
|
isPayInAdvance: false
|
||||||
|
},
|
||||||
|
lineItems: {
|
||||||
|
vaps: []
|
||||||
|
},
|
||||||
|
policy: {
|
||||||
|
noCoverage: false
|
||||||
|
},
|
||||||
|
damage: {}
|
||||||
};
|
};
|
||||||
window.sessionStorage.setItem('submittedOrder', JSON.stringify(testSessionStorage));
|
window.sessionStorage.setItem('submittedOrder', JSON.stringify(testSessionStorage));
|
||||||
const { wrapper } = getMountedComponent();
|
const { wrapper } = getMountedComponent();
|
||||||
|
|
@ -481,7 +552,17 @@ describe('OrderConfirmation.vue', () => {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
appointmentType: 'Inshop'
|
appointmentType: 'Inshop'
|
||||||
}
|
},
|
||||||
|
payment: {
|
||||||
|
isPayInAdvance: false
|
||||||
|
},
|
||||||
|
lineItems: {
|
||||||
|
vaps: []
|
||||||
|
},
|
||||||
|
policy: {
|
||||||
|
noCoverage: false
|
||||||
|
},
|
||||||
|
damage: {}
|
||||||
};
|
};
|
||||||
window.sessionStorage.setItem('submittedOrder', JSON.stringify(testSessionStorage));
|
window.sessionStorage.setItem('submittedOrder', JSON.stringify(testSessionStorage));
|
||||||
const { wrapper } = getMountedComponent();
|
const { wrapper } = getMountedComponent();
|
||||||
|
|
@ -507,7 +588,17 @@ describe('OrderConfirmation.vue', () => {
|
||||||
state: 'AZ',
|
state: 'AZ',
|
||||||
zipCode: '12345',
|
zipCode: '12345',
|
||||||
appointmentType: 'Mobile'
|
appointmentType: 'Mobile'
|
||||||
}
|
},
|
||||||
|
payment: {
|
||||||
|
isPayInAdvance: false
|
||||||
|
},
|
||||||
|
lineItems: {
|
||||||
|
vaps: []
|
||||||
|
},
|
||||||
|
policy: {
|
||||||
|
noCoverage: false
|
||||||
|
},
|
||||||
|
damage: {}
|
||||||
};
|
};
|
||||||
window.sessionStorage.setItem('submittedOrder', JSON.stringify(testSessionStorage));
|
window.sessionStorage.setItem('submittedOrder', JSON.stringify(testSessionStorage));
|
||||||
const { wrapper } = getMountedComponent();
|
const { wrapper } = getMountedComponent();
|
||||||
|
|
@ -536,7 +627,17 @@ describe('OrderConfirmation.vue', () => {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
appointmentType: 'Dropoff'
|
appointmentType: 'Dropoff'
|
||||||
}
|
},
|
||||||
|
payment: {
|
||||||
|
isPayInAdvance: false
|
||||||
|
},
|
||||||
|
lineItems: {
|
||||||
|
vaps: []
|
||||||
|
},
|
||||||
|
policy: {
|
||||||
|
noCoverage: false
|
||||||
|
},
|
||||||
|
damage: {}
|
||||||
};
|
};
|
||||||
window.sessionStorage.setItem('submittedOrder', JSON.stringify(testSessionStorage));
|
window.sessionStorage.setItem('submittedOrder', JSON.stringify(testSessionStorage));
|
||||||
const { wrapper } = getMountedComponent();
|
const { wrapper } = getMountedComponent();
|
||||||
|
|
@ -566,7 +667,17 @@ describe('OrderConfirmation.vue', () => {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
appointmentType: 'Inshop'
|
appointmentType: 'Inshop'
|
||||||
}
|
},
|
||||||
|
payment: {
|
||||||
|
isPayInAdvance: false
|
||||||
|
},
|
||||||
|
lineItems: {
|
||||||
|
vaps: []
|
||||||
|
},
|
||||||
|
policy: {
|
||||||
|
noCoverage: false
|
||||||
|
},
|
||||||
|
damage: {}
|
||||||
};
|
};
|
||||||
window.sessionStorage.setItem('submittedOrder', JSON.stringify(testSessionStorage));
|
window.sessionStorage.setItem('submittedOrder', JSON.stringify(testSessionStorage));
|
||||||
const { wrapper } = getMountedComponent();
|
const { wrapper } = getMountedComponent();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue