From 871226d2ad2e257c15da7af7c0582e6b6a1bf40e Mon Sep 17 00:00:00 2001 From: Josh Dassinger Date: Thu, 19 Sep 2024 14:27:42 -0500 Subject: [PATCH] SSR-1485 Update Unit tests for changes --- .../payment-method/payment-method.spec.js | 89 ++++++++++++++++++- 1 file changed, 88 insertions(+), 1 deletion(-) diff --git a/src/layouts/payment-method/payment-method.spec.js b/src/layouts/payment-method/payment-method.spec.js index b255afab..3e60fce2 100644 --- a/src/layouts/payment-method/payment-method.spec.js +++ b/src/layouts/payment-method/payment-method.spec.js @@ -93,7 +93,12 @@ describe('payment-method.vue', () => { payment: { isPayInAdvance: true, payInAdvanceType: payInAdvanceMethod - } + }, + insuranceCoverage: { + coverageStatus: coverageStatuses.VERIFIED, + coverageType: coverageType.Deductible + }, + currentDeductible: 1000 } }; const wrapper = setupMocks({}, store); @@ -101,6 +106,88 @@ describe('payment-method.vue', () => { // Act const paymethod = wrapper.vm.getPaymentMethodFromStore(); + // Assert + expect(paymethod).toBe(payInAdvanceMethod); + }); + test('getting PAY_AT_TIME_OF_SERVICE when deductible is 0', async () => { + // Arrange + const payInAdvanceMethod = paymentMethods.PAY_AT_TIME_OF_SERVICE; + const store = { + order: { + payment: { + isPayInAdvance: true, + payInAdvanceType: payInAdvanceMethod + }, + insuranceCoverage: { + coverageStatus: coverageStatuses.VERIFIED, + coverageType: coverageType.Deductible + }, + currentDeductible: 0 + } + }; + const wrapper = setupMocks({}, store); + + // Act + const paymethod = wrapper.vm.getPaymentMethodFromStore(); + + // Assert + expect(paymethod).toBe(payInAdvanceMethod); + }); + test('getting PAY_AT_TIME_OF_SERVICE when Unverified', async () => { + // Arrange + const payInAdvanceMethod = paymentMethods.PAY_AT_TIME_OF_SERVICE; + const store = { + order: { + payment: { + isPayInAdvance: true, + payInAdvanceType: payInAdvanceMethod + }, + insuranceCoverage: { + coverageStatus: coverageStatuses.PENDING, + coverageType: coverageType.Deductible + }, + currentDeductible: 1000 + } + }; + const wrapper = setupMocks({}, store); + + // Act + const paymethod = wrapper.vm.getPaymentMethodFromStore(); + + // Assert + expect(paymethod).toBe(payInAdvanceMethod); + }); + test('getting PAY_AT_TIME_OF_SERVICE when PIA Experiment disabled', async () => { + // Arrange + const payInAdvanceMethod = paymentMethods.PAY_AT_TIME_OF_SERVICE; + const mixin = { + methods: { + getSettingValue: jest.fn((settingName) => { + if (settingName === experimentSettings.ISS_DISPLAY_PAY_IN_ADVANCE) { + return 'false'; + } + return 'false'; + }) + } + }; + const store = { + order: { + payment: { + isPayInAdvance: true, + payInAdvanceType: payInAdvanceMethod + }, + insuranceCoverage: { + coverageStatus: coverageStatuses.VERIFIED, + coverageType: coverageType.Deductible + }, + currentDeductible: 1000 + } + }; + const wrapper = setupMocks({}, store, mixin); + + // Act + const paymethod = wrapper.vm.getPaymentMethodFromStore(); + // Assert expect(paymethod).toBe(payInAdvanceMethod); });