SSR-706 Add Unit Tests for field changes
This commit is contained in:
parent
3b4f120943
commit
0bef00dfa7
2 changed files with 7 additions and 2 deletions
|
|
@ -469,6 +469,7 @@ export const useMainStore = defineStore({
|
||||||
}, (error) => {
|
}, (error) => {
|
||||||
this.order.payment.insuranceCoverage.isVerified = false;
|
this.order.payment.insuranceCoverage.isVerified = false;
|
||||||
this.order.payment.insuranceCoverage.coverageStatus = coverageStatuses.PENDING;
|
this.order.payment.insuranceCoverage.coverageStatus = coverageStatuses.PENDING;
|
||||||
|
this.order.payment.insuranceCoverage.claimNumber = null;
|
||||||
return reject(error);
|
return reject(error);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -396,6 +396,7 @@ describe('Store', () => {
|
||||||
expect(globalMethods.callHttpClient).toHaveBeenCalled();
|
expect(globalMethods.callHttpClient).toHaveBeenCalled();
|
||||||
expect(store.payment.insuranceCoverage.isVerified).toBe(true);
|
expect(store.payment.insuranceCoverage.isVerified).toBe(true);
|
||||||
expect(store.payment.insuranceCoverage.coverageStatus).toBe(coverageStatuses.NO_COMP);
|
expect(store.payment.insuranceCoverage.coverageStatus).toBe(coverageStatuses.NO_COMP);
|
||||||
|
expect(store.payment.insuranceCoverage.claimNumber).toBe(null);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('successful response with coverage => isVerified true and coverage status verified', async () => {
|
it('successful response with coverage => isVerified true and coverage status verified', async () => {
|
||||||
|
|
@ -422,11 +423,12 @@ describe('Store', () => {
|
||||||
expect(globalMethods.callHttpClient).toHaveBeenCalled();
|
expect(globalMethods.callHttpClient).toHaveBeenCalled();
|
||||||
expect(store.payment.insuranceCoverage.isVerified).toBe(true);
|
expect(store.payment.insuranceCoverage.isVerified).toBe(true);
|
||||||
expect(store.payment.insuranceCoverage.coverageStatus).toBe(coverageStatuses.VERIFIED);
|
expect(store.payment.insuranceCoverage.coverageStatus).toBe(coverageStatuses.VERIFIED);
|
||||||
|
expect(store.payment.insuranceCoverage.claimNumber).toBe(response.data.claimNumber);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Call to client returns exception, resulting in object with error property being returned', async () => {
|
it('Call to client returns exception, resulting in object with error property being returned', async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
expect.assertions(4);
|
expect.assertions(5);
|
||||||
const error = 'this is the error';
|
const error = 'this is the error';
|
||||||
globalMethods.callHttpClient = jest.fn().mockReturnValue(Promise.reject(error));
|
globalMethods.callHttpClient = jest.fn().mockReturnValue(Promise.reject(error));
|
||||||
|
|
||||||
|
|
@ -439,6 +441,7 @@ describe('Store', () => {
|
||||||
expect(globalMethods.callHttpClient).toHaveBeenCalled();
|
expect(globalMethods.callHttpClient).toHaveBeenCalled();
|
||||||
expect(store.payment.insuranceCoverage.isVerified).toBe(false);
|
expect(store.payment.insuranceCoverage.isVerified).toBe(false);
|
||||||
expect(store.payment.insuranceCoverage.coverageStatus).toBe(coverageStatuses.PENDING);
|
expect(store.payment.insuranceCoverage.coverageStatus).toBe(coverageStatuses.PENDING);
|
||||||
|
expect(store.payment.insuranceCoverage.claimNumber).toBe(null);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -645,7 +648,8 @@ describe('Store', () => {
|
||||||
policyFirstName: customer.firstName,
|
policyFirstName: customer.firstName,
|
||||||
policyLastName: customer.lastName,
|
policyLastName: customer.lastName,
|
||||||
policyPhoneNumber: customer.phoneNumber,
|
policyPhoneNumber: customer.phoneNumber,
|
||||||
policyEmail: customer.emailAddress
|
policyEmail: customer.emailAddress,
|
||||||
|
policyState: customer.address.state
|
||||||
}),
|
}),
|
||||||
policyNumber: policy.policyNumber,
|
policyNumber: policy.policyNumber,
|
||||||
policyZipCode: policy.policyZipCode,
|
policyZipCode: policy.policyZipCode,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue