From 0bef00dfa78e0ad3c7b99c8cd4b70269fd2d878c Mon Sep 17 00:00:00 2001 From: Josh Dassinger Date: Thu, 5 Oct 2023 08:21:24 -0500 Subject: [PATCH] SSR-706 Add Unit Tests for field changes --- src/store/index.js | 1 + src/store/store.spec.js | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/store/index.js b/src/store/index.js index 7f5ed853..fe335f26 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -469,6 +469,7 @@ export const useMainStore = defineStore({ }, (error) => { this.order.payment.insuranceCoverage.isVerified = false; this.order.payment.insuranceCoverage.coverageStatus = coverageStatuses.PENDING; + this.order.payment.insuranceCoverage.claimNumber = null; return reject(error); }); }); diff --git a/src/store/store.spec.js b/src/store/store.spec.js index 9ada327b..895c7e0d 100644 --- a/src/store/store.spec.js +++ b/src/store/store.spec.js @@ -396,6 +396,7 @@ describe('Store', () => { expect(globalMethods.callHttpClient).toHaveBeenCalled(); expect(store.payment.insuranceCoverage.isVerified).toBe(true); 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 () => { @@ -422,11 +423,12 @@ describe('Store', () => { expect(globalMethods.callHttpClient).toHaveBeenCalled(); expect(store.payment.insuranceCoverage.isVerified).toBe(true); 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 () => { // Arrange - expect.assertions(4); + expect.assertions(5); const error = 'this is the error'; globalMethods.callHttpClient = jest.fn().mockReturnValue(Promise.reject(error)); @@ -439,6 +441,7 @@ describe('Store', () => { expect(globalMethods.callHttpClient).toHaveBeenCalled(); expect(store.payment.insuranceCoverage.isVerified).toBe(false); expect(store.payment.insuranceCoverage.coverageStatus).toBe(coverageStatuses.PENDING); + expect(store.payment.insuranceCoverage.claimNumber).toBe(null); }); }); @@ -645,7 +648,8 @@ describe('Store', () => { policyFirstName: customer.firstName, policyLastName: customer.lastName, policyPhoneNumber: customer.phoneNumber, - policyEmail: customer.emailAddress + policyEmail: customer.emailAddress, + policyState: customer.address.state }), policyNumber: policy.policyNumber, policyZipCode: policy.policyZipCode,