From 9503709cf83ed4bd390d4dd509fc90ae70524ff7 Mon Sep 17 00:00:00 2001 From: Jason Lin Date: Thu, 9 Jan 2025 16:59:23 -0500 Subject: [PATCH 1/8] Add withdrawn rates to rate details summary. --- .../RateDetailsSummarySection.test.tsx | 136 ++++++++++++++++++ .../RateDetailsSummarySection.tsx | 25 ++++ 2 files changed, 161 insertions(+) diff --git a/services/app-web/src/pages/StateSubmission/ReviewSubmit/RateDetailsSummarySection.test.tsx b/services/app-web/src/pages/StateSubmission/ReviewSubmit/RateDetailsSummarySection.test.tsx index 7cea4819e4..892d0ec7d4 100644 --- a/services/app-web/src/pages/StateSubmission/ReviewSubmit/RateDetailsSummarySection.test.tsx +++ b/services/app-web/src/pages/StateSubmission/ReviewSubmit/RateDetailsSummarySection.test.tsx @@ -1253,6 +1253,7 @@ describe('RateDetailsSummarySection', () => { ).toBeInTheDocument() }) }) + it('displays deprecated fields on previous submissions viewed by state users', async () => { vi.spyOn( usePreviousSubmission, @@ -1301,6 +1302,7 @@ describe('RateDetailsSummarySection', () => { screen.findByText('Programs this rate certification covers') ).toBeTruthy() }) + it('does not display deprecated fields on unlocked submissions for state users', async () => { const draftContract = mockContractPackageDraft() if ( @@ -1333,4 +1335,138 @@ describe('RateDetailsSummarySection', () => { screen.queryByText('Programs this rate certification covers') ).toBeNull() }) + + it('displays withdrawn rates', async () => { + const contractWithWithdrawnRates = mockContractPackageSubmitted({ + withdrawnRates: [ + { + id: '1234', + webURL: 'https://testmcreview.example/rates/1234', + createdAt: new Date('01/01/2021'), + updatedAt: new Date('01/01/2021'), + status: 'SUBMITTED', + reviewStatus: 'WITHDRAWN', + consolidatedStatus: 'WITHDRAWN', + state: mockMNState(), + stateCode: 'MN', + stateNumber: 5, + parentContractID: 'test-abc-123', + revisions: [], + packageSubmissions: [ + { + cause: 'CONTRACT_SUBMISSION', + submitInfo: { + updatedAt: new Date('01/01/2021'), + updatedBy: { + email: 'testCMS@example.com', + familyName: 'Hotman', + givenName: 'Zuko', + role: 'CMS_USER', + }, + updatedReason: 'Test reason', + }, + contractRevisions: [], + rateRevision: { + id: '1234', + rateID: '5678', + createdAt: new Date('01/01/2021'), + updatedAt: new Date('01/01/2021'), + formData: { + rateType: 'NEW', + rateCapitationType: 'RATE_CELL', + rateDocuments: [ + { + s3URL: 's3://foo/bar/rate', + name: 'rate docs test 1', + sha256: 'fakesha', + dateAdded: new Date(), + }, + ], + supportingDocuments: [], + rateDateStart: new Date('01/01/2021'), + rateDateEnd: new Date('12/31/2021'), + rateDateCertified: new Date('12/31/2020'), + amendmentEffectiveDateStart: new Date( + '01/01/2021' + ), + amendmentEffectiveDateEnd: new Date( + '12/31/2021' + ), + rateCertificationName: + 'WITHDRAWN-RATE-NAME', + rateProgramIDs: [ + 'abbdf9b0-c49e-4c4c-bb6f-040cb7b51cce', + ], + deprecatedRateProgramIDs: [], + consolidatedRateProgramIDs: [ + 'abbdf9b0-c49e-4c4c-bb6f-040cb7b51cce', + ], + certifyingActuaryContacts: [ + { + actuarialFirm: 'DELOITTE', + name: 'Jimmy Jimerson', + titleRole: 'Certifying Actuary', + email: 'jj.actuary@test.com', + }, + ], + addtlActuaryContacts: [ + { + actuarialFirm: 'DELOITTE', + name: 'Additional actuary', + titleRole: 'Test Actuary Contact 1', + email: 'additionalactuarycontact1@test.com', + }, + ], + actuaryCommunicationPreference: + 'OACT_TO_ACTUARY', + packagesWithSharedRateCerts: [], + }, + }, + submittedRevisions: [], + }, + ], + }, + ], + }) + + renderWithProviders( + , + { + apolloProvider: apolloProviderCMSUser, + } + ) + + expect( + screen.getByRole('heading', { + level: 2, + name: 'Rate details', + }) + ).toBeInTheDocument() + // Is this the best way to check that the link is not present? + expect(screen.queryByText('Edit')).not.toBeInTheDocument() + + //expects loading button on component load + expect(screen.getByText('Loading')).toBeInTheDocument() + + // expects download all button after loading has completed + await waitFor(() => { + expect( + screen.getByRole('link', { + name: 'Download all rate documents', + }) + ).toBeInTheDocument() + }) + + // expect withdrawn rate to be on the screen + expect( + screen.getByRole('heading', { + level: 3, + name: /WITHDRAWN-RATE-NAME/, + }) + ).toBeInTheDocument() + }) }) diff --git a/services/app-web/src/pages/StateSubmission/ReviewSubmit/RateDetailsSummarySection.tsx b/services/app-web/src/pages/StateSubmission/ReviewSubmit/RateDetailsSummarySection.tsx index 7f87c14ff9..a0a14634e1 100644 --- a/services/app-web/src/pages/StateSubmission/ReviewSubmit/RateDetailsSummarySection.tsx +++ b/services/app-web/src/pages/StateSubmission/ReviewSubmit/RateDetailsSummarySection.tsx @@ -41,6 +41,7 @@ import { useParams } from 'react-router-dom' import { LinkWithLogging } from '../../../components/TealiumLogging/Link' import classnames from 'classnames' import { hasCMSUserPermissions } from '@mc-review/helpers' +import { InfoTag } from '../../../components/InfoTag/InfoTag' export type RateDetailsSummarySectionProps = { contract: Contract | UnlockedContract @@ -107,6 +108,15 @@ export const RateDetailsSummarySection = ({ ? rateRevisions : getVisibleLatestRateRevisions(contract, isEditing) + const withdrawnRateRevisions: RateRevision[] = + contract.withdrawnRates?.reduce((acc, rate) => { + const latestRevision = rate.packageSubmissions?.[0].rateRevision + if (rate.consolidatedStatus === 'WITHDRAWN' && latestRevision) { + acc.push(latestRevision) + } + return acc + }, [] as RateRevision[]) || [] + // Calculate last submitted data for document upload tables const lastSubmittedIndex = getIndexFromRevisionVersion( contract, @@ -575,6 +585,21 @@ export const RateDetailsSummarySection = ({ : (isSubmitted || isStateUser) && ( )} + {withdrawnRateRevisions.length > 0 && + withdrawnRateRevisions.map((rateRev) => ( + +

+ WITHDRAWN{' '} + {rateRev.formData.rateCertificationName} +

+
+ ))} ) } From 98a6f3bc8314ae8ebd116c1d3a82e0168cc25fda Mon Sep 17 00:00:00 2001 From: Jason Lin Date: Thu, 9 Jan 2025 17:00:22 -0500 Subject: [PATCH 2/8] Add a new shade of gray --- .../app-web/src/components/InfoTag/InfoTag.module.scss | 5 +++++ services/app-web/src/components/InfoTag/InfoTag.tsx | 10 +++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/services/app-web/src/components/InfoTag/InfoTag.module.scss b/services/app-web/src/components/InfoTag/InfoTag.module.scss index a6629e70d9..01866f758b 100644 --- a/services/app-web/src/components/InfoTag/InfoTag.module.scss +++ b/services/app-web/src/components/InfoTag/InfoTag.module.scss @@ -13,6 +13,11 @@ color: custom.$mcr-foundation-ink; } +.gray-medium { + @include uswds.u-bg('gray-60'); + color: custom.$mcr-foundation-white; +} + .light-green { @include uswds.u-bg('green-cool-20v'); color: custom.$mcr-foundation-ink; diff --git a/services/app-web/src/components/InfoTag/InfoTag.tsx b/services/app-web/src/components/InfoTag/InfoTag.tsx index 6a5402eb33..62f686584d 100644 --- a/services/app-web/src/components/InfoTag/InfoTag.tsx +++ b/services/app-web/src/components/InfoTag/InfoTag.tsx @@ -9,7 +9,14 @@ Main application-wide tag to draw attention to key info. This is a react-uswds Tag enhanced with CMS styles. */ export type TagProps = { - color: 'green' | 'gold' | 'cyan' | 'blue' | 'light green' | 'gray' + color: + | 'green' + | 'gold' + | 'cyan' + | 'blue' + | 'light green' + | 'gray' + | 'gray-medium' emphasize?: boolean } & ComponentProps @@ -28,6 +35,7 @@ export const InfoTag = ({ [styles['gold']]: color === 'gold', [styles['blue']]: color === 'blue', [styles['gray']]: color === 'gray', + [styles['gray-medium']]: color === 'gray-medium', }, emphasize ? styles['emphasize'] : undefined, className From 2318064ed5668094a440ae60c053bcab093a0864 Mon Sep 17 00:00:00 2001 From: Jason Lin Date: Thu, 9 Jan 2025 18:37:46 -0500 Subject: [PATCH 3/8] Don't show download all docs if no rates exist. --- .../RateDetailsSummarySection.tsx | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/services/app-web/src/pages/StateSubmission/ReviewSubmit/RateDetailsSummarySection.tsx b/services/app-web/src/pages/StateSubmission/ReviewSubmit/RateDetailsSummarySection.tsx index a0a14634e1..be57536f95 100644 --- a/services/app-web/src/pages/StateSubmission/ReviewSubmit/RateDetailsSummarySection.tsx +++ b/services/app-web/src/pages/StateSubmission/ReviewSubmit/RateDetailsSummarySection.tsx @@ -70,7 +70,7 @@ type PackageNamesLookupType = { export function renderDownloadButton( zippedFilesURL: string | undefined | Error ) { - if (zippedFilesURL instanceof Error) { + if (zippedFilesURL instanceof Error || !zippedFilesURL) { return ( ) @@ -115,7 +115,7 @@ export const RateDetailsSummarySection = ({ acc.push(latestRevision) } return acc - }, [] as RateRevision[]) || [] + }, [] as RateRevision[]) ?? [] // Calculate last submitted data for document upload tables const lastSubmittedIndex = getIndexFromRevisionVersion( @@ -237,8 +237,10 @@ export const RateDetailsSummarySection = ({ // get all the keys for the documents we want to zip async function fetchZipUrl() { const submittedRates = - getLastContractSubmission(contract)?.rateRevisions - if (submittedRates !== undefined) { + getLastContractSubmission(contract)?.rateRevisions ?? [] + + // skip if no rates + if (submittedRates.length > 0) { const keysFromDocs = submittedRates .flatMap((rateInfo) => rateInfo.formData.rateDocuments.concat( @@ -289,6 +291,12 @@ export const RateDetailsSummarySection = ({ isAdminUser && !isLinkedRate && !isPreviousSubmission, }) + const showDownloadAllButton = + isSubmittedOrCMSUser && + !isPreviousSubmission && + rateRevs && + rateRevs.length > 0 + const noRatesMessage = () => { if (isStateUser) { return isSubmitted @@ -309,9 +317,7 @@ export const RateDetailsSummarySection = ({ header="Rate details" editNavigateTo={editNavigateTo} > - {isSubmittedOrCMSUser && - !isPreviousSubmission && - renderDownloadButton(zippedFilesURL)} + {showDownloadAllButton && renderDownloadButton(zippedFilesURL)} {rateRevs && rateRevs.length > 0 ? rateRevs.map((rateRev) => { From 09762505f90f8fe3fe8f35267cfd3d0252a0d59e Mon Sep 17 00:00:00 2001 From: Jason Lin Date: Thu, 9 Jan 2025 19:02:14 -0500 Subject: [PATCH 4/8] Update tests to not look for download button when no rates exist --- .../ReviewSubmit/RateDetailsSummarySection.test.tsx | 6 ------ 1 file changed, 6 deletions(-) diff --git a/services/app-web/src/pages/StateSubmission/ReviewSubmit/RateDetailsSummarySection.test.tsx b/services/app-web/src/pages/StateSubmission/ReviewSubmit/RateDetailsSummarySection.test.tsx index 892d0ec7d4..85407d8cfe 100644 --- a/services/app-web/src/pages/StateSubmission/ReviewSubmit/RateDetailsSummarySection.test.tsx +++ b/services/app-web/src/pages/StateSubmission/ReviewSubmit/RateDetailsSummarySection.test.tsx @@ -224,9 +224,6 @@ describe('RateDetailsSummarySection', () => { // Is this the best way to check that the link is not present? expect(screen.queryByText('Edit')).not.toBeInTheDocument() - //expects loading button on component load - expect(screen.getByText('Loading')).toBeInTheDocument() - // expects download all button after loading has completed await waitFor(() => { expect( @@ -1449,9 +1446,6 @@ describe('RateDetailsSummarySection', () => { // Is this the best way to check that the link is not present? expect(screen.queryByText('Edit')).not.toBeInTheDocument() - //expects loading button on component load - expect(screen.getByText('Loading')).toBeInTheDocument() - // expects download all button after loading has completed await waitFor(() => { expect( From dbe58f560109e61066f2cd5c34177b9563788439 Mon Sep 17 00:00:00 2001 From: Jason Lin Date: Thu, 9 Jan 2025 21:15:24 -0500 Subject: [PATCH 5/8] Update InfoTag with new color --- .../app-web/src/components/InfoTag/InfoTag.module.scss | 5 +++++ services/app-web/src/components/InfoTag/InfoTag.tsx | 10 +++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/services/app-web/src/components/InfoTag/InfoTag.module.scss b/services/app-web/src/components/InfoTag/InfoTag.module.scss index a6629e70d9..01866f758b 100644 --- a/services/app-web/src/components/InfoTag/InfoTag.module.scss +++ b/services/app-web/src/components/InfoTag/InfoTag.module.scss @@ -13,6 +13,11 @@ color: custom.$mcr-foundation-ink; } +.gray-medium { + @include uswds.u-bg('gray-60'); + color: custom.$mcr-foundation-white; +} + .light-green { @include uswds.u-bg('green-cool-20v'); color: custom.$mcr-foundation-ink; diff --git a/services/app-web/src/components/InfoTag/InfoTag.tsx b/services/app-web/src/components/InfoTag/InfoTag.tsx index 6a5402eb33..62f686584d 100644 --- a/services/app-web/src/components/InfoTag/InfoTag.tsx +++ b/services/app-web/src/components/InfoTag/InfoTag.tsx @@ -9,7 +9,14 @@ Main application-wide tag to draw attention to key info. This is a react-uswds Tag enhanced with CMS styles. */ export type TagProps = { - color: 'green' | 'gold' | 'cyan' | 'blue' | 'light green' | 'gray' + color: + | 'green' + | 'gold' + | 'cyan' + | 'blue' + | 'light green' + | 'gray' + | 'gray-medium' emphasize?: boolean } & ComponentProps @@ -28,6 +35,7 @@ export const InfoTag = ({ [styles['gold']]: color === 'gold', [styles['blue']]: color === 'blue', [styles['gray']]: color === 'gray', + [styles['gray-medium']]: color === 'gray-medium', }, emphasize ? styles['emphasize'] : undefined, className From 7407a495df0bd329fd090d02d1bc69c677fd0600 Mon Sep 17 00:00:00 2001 From: Jason Lin Date: Thu, 9 Jan 2025 21:16:08 -0500 Subject: [PATCH 6/8] Add withdrawn rates mock --- .../src/apollo/contractPackageDataMock.ts | 91 +++++++++++++++++++ 1 file changed, 91 insertions(+) diff --git a/packages/mocks/src/apollo/contractPackageDataMock.ts b/packages/mocks/src/apollo/contractPackageDataMock.ts index 08da819027..362e8759cc 100644 --- a/packages/mocks/src/apollo/contractPackageDataMock.ts +++ b/packages/mocks/src/apollo/contractPackageDataMock.ts @@ -7,6 +7,7 @@ import { UnlockedContract, CmsUser, StateUser, + Rate, } from '../gen/gqlClient' import { s3DlUrl } from './documentDataMock' @@ -2833,6 +2834,95 @@ const mockEmptyDraftContractAndRate = (): Contract => withdrawnRates: [], }) +const mockWithdrawnRates = (parentContractID?: string): Rate[] => { + return [ + { + id: '1234', + webURL: 'https://testmcreview.example/rates/1234', + createdAt: new Date('01/01/2021'), + updatedAt: new Date('01/01/2021'), + status: 'SUBMITTED', + reviewStatus: 'WITHDRAWN', + consolidatedStatus: 'WITHDRAWN', + state: mockMNState(), + stateCode: 'MN', + stateNumber: 5, + parentContractID: parentContractID ?? 'test-abc-123', + revisions: [], + packageSubmissions: [ + { + cause: 'CONTRACT_SUBMISSION', + submitInfo: { + updatedAt: new Date('01/01/2021'), + updatedBy: { + email: 'testCMS@example.com', + familyName: 'Hotman', + givenName: 'Zuko', + role: 'CMS_USER', + }, + updatedReason: 'Withdrawn rate reason', + }, + contractRevisions: [], + rateRevision: { + id: 'test-rate-revision-id', + rateID: '1234', + createdAt: new Date('01/01/2021'), + updatedAt: new Date('01/01/2021'), + formData: { + ...mockRateRevision().formData, + rateCertificationName: + 'WITHDRAWN-RATE-1-NAME' + }, + }, + submittedRevisions: [], + }, + ], + }, + { + id: '5678', + webURL: 'https://testmcreview.example/rates/5678', + createdAt: new Date('01/01/2021'), + updatedAt: new Date('01/01/2021'), + status: 'SUBMITTED', + reviewStatus: 'WITHDRAWN', + consolidatedStatus: 'WITHDRAWN', + state: mockMNState(), + stateCode: 'MN', + stateNumber: 5, + parentContractID: parentContractID ?? 'test-abc-123', + revisions: [], + packageSubmissions: [ + { + cause: 'CONTRACT_SUBMISSION', + submitInfo: { + updatedAt: new Date('01/01/2021'), + updatedBy: { + email: 'testCMS@example.com', + familyName: 'Hotman', + givenName: 'Zuko', + role: 'CMS_USER', + }, + updatedReason: 'Withdrawn rate reason', + }, + contractRevisions: [], + rateRevision: { + id: 'test-rate-revision-id', + rateID: '5678', + createdAt: new Date('01/01/2021'), + updatedAt: new Date('01/01/2021'), + formData: { + ...mockRateRevision().formData, + rateCertificationName: + 'WITHDRAWN-RATE-2-NAME' + }, + }, + submittedRevisions: [], + }, + ], + }, + ] +} + export { mockContractRevision, mockContractPackageDraft, @@ -2848,4 +2938,5 @@ export { mockContractPackageSubmittedWithQuestions, mockContractPackageApproved, mockContractPackageApprovedWithQuestions, + mockWithdrawnRates } From cb13fbae17ea75c662130e7a65ccb821673fa1fe Mon Sep 17 00:00:00 2001 From: Jason Lin Date: Thu, 9 Jan 2025 21:17:51 -0500 Subject: [PATCH 7/8] Show withdrawn rate name with tag on rate details page --- .../RateDetails/RateDetails.test.tsx | 66 +++++++++++++++++-- .../RateDetails/V2/RateDetailsV2.tsx | 54 ++++++++++++--- 2 files changed, 103 insertions(+), 17 deletions(-) diff --git a/services/app-web/src/pages/StateSubmission/RateDetails/RateDetails.test.tsx b/services/app-web/src/pages/StateSubmission/RateDetails/RateDetails.test.tsx index 40d7b7f4c8..980f86c622 100644 --- a/services/app-web/src/pages/StateSubmission/RateDetails/RateDetails.test.tsx +++ b/services/app-web/src/pages/StateSubmission/RateDetails/RateDetails.test.tsx @@ -13,19 +13,16 @@ import { updateDraftContractRatesMockSuccess, mockContractWithLinkedRateDraft, mockContractPackageDraft, -} from '@mc-review/mocks' -import { Route, Routes, Location } from 'react-router-dom' -import { RoutesRecord } from '@mc-review/constants' -import userEvent from '@testing-library/user-event' -import { rateDataMock, rateRevisionDataMock, draftRateDataMock, -} from '@mc-review/mocks' -import { fetchDraftRateMockSuccess, indexRatesMockSuccess, + mockWithdrawnRates, } from '@mc-review/mocks' +import { Route, Routes, Location } from 'react-router-dom' +import { RoutesRecord } from '@mc-review/constants' +import userEvent from '@testing-library/user-event' import { clickAddNewRate, fillOutFirstRate, @@ -1674,4 +1671,59 @@ describe('RateDetails', () => { expect(removeButtonsPostRemoval).toHaveLength(2) }) }) + + describe('handles withdrawn rates', () => { + const withdrawnRates = mockWithdrawnRates() + it('renders withdrawn rates', async () => { + renderWithProviders( + + } + /> + , + { + apolloProvider: { + mocks: [ + fetchCurrentUserMock({ statusCode: 200 }), + fetchContractMockSuccess({ + contract: { + ...mockContractWithLinkedRateDraft(), + id: 'test-abc-123', + withdrawnRates, + }, + }), + ], + }, + routerProvider: { + route: `/submissions/test-abc-123/edit/rate-details`, + }, + featureFlags: { + 'rate-edit-unlock': false, + }, + } + ) + + await screen.findByText('Rate Details') + expect( + screen.getByText( + 'Was this rate certification included with another submission?' + ) + ).toBeInTheDocument() + + // expect withdrawn rates to be on the screen + expect( + screen.getByRole('heading', { + level: 3, + name: /WITHDRAWN-RATE-1-NAME/, + }) + ).toBeInTheDocument() + expect( + screen.getByRole('heading', { + level: 3, + name: /WITHDRAWN-RATE-2-NAME/, + }) + ).toBeInTheDocument() + }) + }) }) diff --git a/services/app-web/src/pages/StateSubmission/RateDetails/V2/RateDetailsV2.tsx b/services/app-web/src/pages/StateSubmission/RateDetails/V2/RateDetailsV2.tsx index 4015fd7ac7..b2240596ba 100644 --- a/services/app-web/src/pages/StateSubmission/RateDetails/V2/RateDetailsV2.tsx +++ b/services/app-web/src/pages/StateSubmission/RateDetails/V2/RateDetailsV2.tsx @@ -54,6 +54,7 @@ import { import { LinkYourRates } from '../../../LinkYourRates/LinkYourRates' import { LinkedRateSummary } from '../LinkedRateSummary' import { usePage } from '../../../../contexts/PageContext' +import { InfoTag } from '../../../../components/InfoTag/InfoTag' export type FormikRateForm = { id?: string // no id if its a new rate @@ -164,20 +165,28 @@ const RateDetails = ({ } }, [focusNewRate]) - const pageHeading = displayAsStandaloneRate - ? fetchRateData?.fetchRate.rate.draftRevision?.formData - .rateCertificationName - : fetchContractData?.fetchContract.contract?.draftRevision?.contractName - if (pageHeading) updateHeading({ customHeading: pageHeading }) - const [updateDraftContractRates] = useUpdateDraftContractRatesMutation() - const [submitRate] = useSubmitRateMutation() - // Set up data for form. Either based on contract API (for multi rate) or rates API (for edit and submit of standalone rate) const contract = fetchContractData?.fetchContract.contract const contractDraftRevision = contract?.draftRevision const ratesFromContract = contract?.draftRates const initialRequestLoading = fetchContractLoading || fetchRateLoading const initialRequestError = fetchContractError || fetchRateError + const withdrawnRateRevisions: RateRevision[] = + contract?.withdrawnRates?.reduce((acc, rate) => { + const latestRevision = rate.packageSubmissions?.[0].rateRevision + if (rate.consolidatedStatus === 'WITHDRAWN' && latestRevision) { + acc.push(latestRevision) + } + return acc + }, [] as RateRevision[]) ?? [] + + const pageHeading = displayAsStandaloneRate + ? fetchRateData?.fetchRate.rate.draftRevision?.formData + .rateCertificationName + : contract?.draftRevision?.contractName + if (pageHeading) updateHeading({ customHeading: pageHeading }) + const [updateDraftContractRates] = useUpdateDraftContractRatesMutation() + const [submitRate] = useSubmitRateMutation() // Set up initial rate form values for Formik const initialRates: Rate[] = React.useMemo( @@ -394,8 +403,7 @@ const RateDetails = ({ )} + {withdrawnRateRevisions.length > + 0 && + withdrawnRateRevisions.map( + (rateRev) => ( + +

+ + WITHDRAWN + {' '} + { + rateRev + .formData + .rateCertificationName + } +

+
+ ) + )} )} From 92eebb654e865ba3360923b17ee8bc50e998a574 Mon Sep 17 00:00:00 2001 From: Jason Lin Date: Fri, 10 Jan 2025 11:02:38 -0500 Subject: [PATCH 8/8] Use mockData function for test --- .../RateDetailsSummarySection.test.tsx | 101 ++---------------- 1 file changed, 10 insertions(+), 91 deletions(-) diff --git a/services/app-web/src/pages/StateSubmission/ReviewSubmit/RateDetailsSummarySection.test.tsx b/services/app-web/src/pages/StateSubmission/ReviewSubmit/RateDetailsSummarySection.test.tsx index 85407d8cfe..edff3cf319 100644 --- a/services/app-web/src/pages/StateSubmission/ReviewSubmit/RateDetailsSummarySection.test.tsx +++ b/services/app-web/src/pages/StateSubmission/ReviewSubmit/RateDetailsSummarySection.test.tsx @@ -11,6 +11,7 @@ import { mockContractPackageUnlockedWithUnlockedType, mockContractWithLinkedRateDraft, mockContractWithLinkedRateSubmitted, + mockWithdrawnRates, } from '@mc-review/mocks' import { renderWithProviders } from '../../../testHelpers/jestHelpers' import { RateDetailsSummarySection } from './RateDetailsSummarySection' @@ -1335,95 +1336,7 @@ describe('RateDetailsSummarySection', () => { it('displays withdrawn rates', async () => { const contractWithWithdrawnRates = mockContractPackageSubmitted({ - withdrawnRates: [ - { - id: '1234', - webURL: 'https://testmcreview.example/rates/1234', - createdAt: new Date('01/01/2021'), - updatedAt: new Date('01/01/2021'), - status: 'SUBMITTED', - reviewStatus: 'WITHDRAWN', - consolidatedStatus: 'WITHDRAWN', - state: mockMNState(), - stateCode: 'MN', - stateNumber: 5, - parentContractID: 'test-abc-123', - revisions: [], - packageSubmissions: [ - { - cause: 'CONTRACT_SUBMISSION', - submitInfo: { - updatedAt: new Date('01/01/2021'), - updatedBy: { - email: 'testCMS@example.com', - familyName: 'Hotman', - givenName: 'Zuko', - role: 'CMS_USER', - }, - updatedReason: 'Test reason', - }, - contractRevisions: [], - rateRevision: { - id: '1234', - rateID: '5678', - createdAt: new Date('01/01/2021'), - updatedAt: new Date('01/01/2021'), - formData: { - rateType: 'NEW', - rateCapitationType: 'RATE_CELL', - rateDocuments: [ - { - s3URL: 's3://foo/bar/rate', - name: 'rate docs test 1', - sha256: 'fakesha', - dateAdded: new Date(), - }, - ], - supportingDocuments: [], - rateDateStart: new Date('01/01/2021'), - rateDateEnd: new Date('12/31/2021'), - rateDateCertified: new Date('12/31/2020'), - amendmentEffectiveDateStart: new Date( - '01/01/2021' - ), - amendmentEffectiveDateEnd: new Date( - '12/31/2021' - ), - rateCertificationName: - 'WITHDRAWN-RATE-NAME', - rateProgramIDs: [ - 'abbdf9b0-c49e-4c4c-bb6f-040cb7b51cce', - ], - deprecatedRateProgramIDs: [], - consolidatedRateProgramIDs: [ - 'abbdf9b0-c49e-4c4c-bb6f-040cb7b51cce', - ], - certifyingActuaryContacts: [ - { - actuarialFirm: 'DELOITTE', - name: 'Jimmy Jimerson', - titleRole: 'Certifying Actuary', - email: 'jj.actuary@test.com', - }, - ], - addtlActuaryContacts: [ - { - actuarialFirm: 'DELOITTE', - name: 'Additional actuary', - titleRole: 'Test Actuary Contact 1', - email: 'additionalactuarycontact1@test.com', - }, - ], - actuaryCommunicationPreference: - 'OACT_TO_ACTUARY', - packagesWithSharedRateCerts: [], - }, - }, - submittedRevisions: [], - }, - ], - }, - ], + withdrawnRates: mockWithdrawnRates(), }) renderWithProviders( @@ -1455,11 +1368,17 @@ describe('RateDetailsSummarySection', () => { ).toBeInTheDocument() }) - // expect withdrawn rate to be on the screen + // expect withdrawn rates to be on the screen + expect( + screen.getByRole('heading', { + level: 3, + name: /WITHDRAWN-RATE-1-NAME/, + }) + ).toBeInTheDocument() expect( screen.getByRole('heading', { level: 3, - name: /WITHDRAWN-RATE-NAME/, + name: /WITHDRAWN-RATE-2-NAME/, }) ).toBeInTheDocument() })