From caa1eb82b8200cd9c12a0efb506965f7faae2522 Mon Sep 17 00:00:00 2001 From: ruizajtruss Date: Tue, 16 Apr 2024 22:48:21 +0000 Subject: [PATCH] test fixes --- .../app-web/src/formHelpers/formatters.ts | 24 +++++++++++++++++++ .../RateDetails/V2/SingleRateFormFields.tsx | 2 +- .../RateDetails/V2/rateDetailsHelpers.ts | 3 ++- 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/services/app-web/src/formHelpers/formatters.ts b/services/app-web/src/formHelpers/formatters.ts index a396533ace..798629fc40 100644 --- a/services/app-web/src/formHelpers/formatters.ts +++ b/services/app-web/src/formHelpers/formatters.ts @@ -40,6 +40,29 @@ function formatForForm ( // This function can be cleaned up when we move off domain types and only use graphql const formatActuaryContactsForForm = (actuaryContacts?: ActuaryContact[] | GQLActuaryContact[]) : ActuaryContact[] => { + return actuaryContacts && actuaryContacts.length > 0 + ? actuaryContacts.map( (contact) => { + const {name, titleRole,email,actuarialFirm, actuarialFirmOther} = contact + return { + name: name ?? '', + titleRole: titleRole ?? '', + email: email ?? '', + actuarialFirmOther: actuarialFirmOther ?? undefined, + actuarialFirm: actuarialFirm ?? undefined, + } + }) + : [ + { + name: '', + titleRole: '', + email: '', + actuarialFirm: undefined, + actuarialFirmOther: '', + }, + ] +} + +const formatAddtlActuaryContactsForForm = (actuaryContacts?: ActuaryContact[] | GQLActuaryContact[]) : ActuaryContact[] => { return actuaryContacts && actuaryContacts.length > 0 ? actuaryContacts.map( (contact) => { const {name, titleRole,email,actuarialFirm, actuarialFirmOther} = contact @@ -199,6 +222,7 @@ export { formatDocumentsForDomain, formatDocumentsForForm, formatActuaryContactsForForm, + formatAddtlActuaryContactsForForm, formatDocumentsForGQL, formatFormDateForGQL } diff --git a/services/app-web/src/pages/StateSubmission/RateDetails/V2/SingleRateFormFields.tsx b/services/app-web/src/pages/StateSubmission/RateDetails/V2/SingleRateFormFields.tsx index bdf56a4c73..e2110580ff 100644 --- a/services/app-web/src/pages/StateSubmission/RateDetails/V2/SingleRateFormFields.tsx +++ b/services/app-web/src/pages/StateSubmission/RateDetails/V2/SingleRateFormFields.tsx @@ -497,7 +497,7 @@ export const SingleRateFormFields = ({ diff --git a/services/app-web/src/pages/StateSubmission/RateDetails/V2/rateDetailsHelpers.ts b/services/app-web/src/pages/StateSubmission/RateDetails/V2/rateDetailsHelpers.ts index 89d76e2493..e538313b20 100644 --- a/services/app-web/src/pages/StateSubmission/RateDetails/V2/rateDetailsHelpers.ts +++ b/services/app-web/src/pages/StateSubmission/RateDetails/V2/rateDetailsHelpers.ts @@ -1,5 +1,6 @@ import { formatActuaryContactsForForm, + formatAddtlActuaryContactsForForm, formatDocumentsForForm, formatDocumentsForGQL, formatForForm, @@ -93,7 +94,7 @@ const convertGQLRateToRateForm = (getKey: S3ClientT['getKey'], rate?: Rate): For actuaryContacts: formatActuaryContactsForForm( rateForm?.certifyingActuaryContacts ), - addtlActuaryContacts: formatActuaryContactsForForm( + addtlActuaryContacts: formatAddtlActuaryContactsForForm( rateForm?.certifyingActuaryContacts ), actuaryCommunicationPreference: