ISR-10442: Add unit tests for new helper

This commit is contained in:
Alex Humphries 2026-07-17 17:45:27 -04:00
parent 0cc245ca84
commit d1af95bc15

View file

@ -0,0 +1,68 @@
import { updateClientSpecificFieldsForClaimRegistration } from '@/helpers/coverage-helper';
import parentAccountNumber from '@/constants/parent-account-numbers';
let mockStore;
jest.mock('@/store', () => ({
useMainStore: jest.fn(() => mockStore)
}));
describe('coverage-helper.js', () => {
describe('updateClientSpecificFieldsForClaimRegistration', () => {
beforeEach(() => {
mockStore = {
order: {
parentAccountNumber: null
},
isITAC: false
};
jest.clearAllMocks();
});
test('Sets additionalInfo fields when parent account is USAA and isITAC is true', () => {
// Arrange
const payload = {};
mockStore.order.parentAccountNumber = parentAccountNumber.USAA;
mockStore.isITAC = true;
// Act
updateClientSpecificFieldsForClaimRegistration(payload);
// Assert
expect(payload.additionalInfo).toEqual({
offeredItac: 'true',
qualifiedForItac: 'true'
});
});
test('Sets additionalInfo fields when parent account is USAA and isITAC is false', () => {
// Arrange
const payload = {};
mockStore.order.parentAccountNumber = parentAccountNumber.USAA;
mockStore.isITAC = false;
// Act
updateClientSpecificFieldsForClaimRegistration(payload);
// Assert
expect(payload.additionalInfo).toEqual({
offeredItac: 'false',
qualifiedForItac: 'false'
});
});
test('Does not set additionalInfo when parent account is not USAA', () => {
// Arrange
const payload = {};
mockStore.order.parentAccountNumber = 123456;
mockStore.isITAC = true;
// Act
updateClientSpecificFieldsForClaimRegistration(payload);
// Assert
expect(payload.additionalInfo).toBeUndefined();
});
});
});