Skip to content

Commit

Permalink
test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ruizajtruss committed Apr 16, 2024
1 parent 35fbdfb commit caa1eb8
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
24 changes: 24 additions & 0 deletions services/app-web/src/formHelpers/formatters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,29 @@ function formatForForm<T> (

// 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
Expand Down Expand Up @@ -199,6 +222,7 @@ export {
formatDocumentsForDomain,
formatDocumentsForForm,
formatActuaryContactsForForm,
formatAddtlActuaryContactsForForm,
formatDocumentsForGQL,
formatFormDateForGQL
}
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ export const SingleRateFormFields = ({
<FormGroup>
<ActuaryContactFields
shouldValidate={shouldValidate}
fieldNamePrefix={`${fieldNamePrefix}.actuaryContacts.${index}`}
fieldNamePrefix={`${fieldNamePrefix}.actuaryContacts.0`}
fieldSetLegend="Certifying Actuary"
/>
<FieldArray name={`${fieldNamePrefix}.addtlActuaryContacts`}>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {
formatActuaryContactsForForm,
formatAddtlActuaryContactsForForm,
formatDocumentsForForm,
formatDocumentsForGQL,
formatForForm,
Expand Down Expand Up @@ -93,7 +94,7 @@ const convertGQLRateToRateForm = (getKey: S3ClientT['getKey'], rate?: Rate): For
actuaryContacts: formatActuaryContactsForForm(
rateForm?.certifyingActuaryContacts
),
addtlActuaryContacts: formatActuaryContactsForForm(
addtlActuaryContacts: formatAddtlActuaryContactsForForm(
rateForm?.certifyingActuaryContacts
),
actuaryCommunicationPreference:
Expand Down

0 comments on commit caa1eb8

Please sign in to comment.