Add new test to handle different clearOnSubmit scenarios
This commit is contained in:
parent
7f5a91c6d4
commit
3236ce79c4
1 changed files with 37 additions and 1 deletions
|
|
@ -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