From d1af95bc15f19a59596314b4bdaa472dbb83ff1e Mon Sep 17 00:00:00 2001 From: Alex Humphries Date: Fri, 17 Jul 2026 17:45:27 -0400 Subject: [PATCH] ISR-10442: Add unit tests for new helper --- src/helpers/coverage-helper.spec.js | 68 +++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 src/helpers/coverage-helper.spec.js diff --git a/src/helpers/coverage-helper.spec.js b/src/helpers/coverage-helper.spec.js new file mode 100644 index 00000000..6b10cf84 --- /dev/null +++ b/src/helpers/coverage-helper.spec.js @@ -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(); + }); + }); +});