SSR-1485 Update Unit tests for changes

This commit is contained in:
Josh Dassinger 2024-09-19 14:27:42 -05:00
parent 813898e8e5
commit 871226d2ad

View file

@ -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);
});