Merge pull request #1226 from Safelite/feature/humphries/INSR-9651
INSR-9651: Do not clear VAPs prices on deductible submit
This commit is contained in:
commit
dec7124fe6
2 changed files with 38 additions and 2 deletions
|
|
@ -1440,7 +1440,7 @@ export const useMainStore = defineStore({
|
|||
const shouldClearOnSubmit = this.isVerified && this.isDeductible;
|
||||
const payloadGlassParts = setClearOnSubmit(lineItems.glassParts, shouldClearOnSubmit);
|
||||
const payloadSupportingItems = setClearOnSubmit(lineItems.supportingItems, shouldClearOnSubmit);
|
||||
const payloadVapsItems = setClearOnSubmit(lineItems.vaps, shouldClearOnSubmit);
|
||||
const payloadVapsItems = setClearOnSubmit(lineItems.vaps, false);
|
||||
const payloadFeeItems = setClearOnSubmit(lineItems.feeItems, shouldClearOnSubmit);
|
||||
|
||||
const payload = {
|
||||
|
|
|
|||
|
|
@ -796,7 +796,43 @@ describe('Store', () => {
|
|||
})
|
||||
}));
|
||||
});
|
||||
it('calls api with expected lineItems', async () => {
|
||||
it('calls api with expected lineItems for verified deductible', async () => {
|
||||
// Arrange
|
||||
const glassParts = [{
|
||||
partNumber: getRandomString(6, 6),
|
||||
clearOnSubmit: true
|
||||
}];
|
||||
const supportingItems = [{
|
||||
partNumber: getRandomString(6, 6),
|
||||
clearOnSubmit: true
|
||||
}];
|
||||
const vaps = [{
|
||||
partNumber: getRandomString(6, 6),
|
||||
clearOnSubmit: false
|
||||
}];
|
||||
store.order.insuranceCoverage.coverageStatus = coverageStatuses.VERIFIED;
|
||||
store.order.insuranceCoverage.coverageType = coverageType.Deductible;
|
||||
store.order.lineItems.glassParts = glassParts;
|
||||
store.order.lineItems.supportingItems = supportingItems;
|
||||
store.order.lineItems.vaps = vaps;
|
||||
|
||||
globalMethods.callHttpClient = jest.fn().mockReturnValue(Promise.resolve({}));
|
||||
|
||||
// Act
|
||||
await store.saveSession({});
|
||||
|
||||
// Assert
|
||||
expect(globalMethods.callHttpClient).toHaveBeenCalledWith(expect.objectContaining({
|
||||
payload: expect.objectContaining({
|
||||
lineItems: expect.objectContaining({
|
||||
glassParts,
|
||||
supportingItems,
|
||||
vaps
|
||||
})
|
||||
})
|
||||
}));
|
||||
});
|
||||
it('calls api with expected lineItems for other coverage types', async () => {
|
||||
// Arrange
|
||||
const glassParts = [{
|
||||
partNumber: getRandomString(6, 6),
|
||||
|
|
|
|||
Loading…
Reference in a new issue