diff --git a/services/app-web/src/pages/SubmissionSummary/V2/SubmissionSummaryV2.test.tsx b/services/app-web/src/pages/SubmissionSummary/V2/SubmissionSummaryV2.test.tsx index 12d1dd0850..45b6106936 100644 --- a/services/app-web/src/pages/SubmissionSummary/V2/SubmissionSummaryV2.test.tsx +++ b/services/app-web/src/pages/SubmissionSummary/V2/SubmissionSummaryV2.test.tsx @@ -1,6 +1,5 @@ import { screen, waitFor, within } from '@testing-library/react' import { Route, Routes } from 'react-router' -import { domainToBase64 } from '../../../common-code/proto/healthPlanFormDataProto' import { RoutesRecord } from '../../../constants/routes' import { fetchCurrentUserMock, @@ -9,10 +8,8 @@ import { mockValidCMSUser, mockValidUser, mockValidStateUser, - mockUnlockedHealthPlanPackage, mockContractPackageSubmitted, } from '../../../testHelpers/apolloMocks' -import { basicLockedHealthPlanFormData } from '../../../common-code/healthPlanFormDataMocks' import { renderWithProviders } from '../../../testHelpers/jestHelpers' import { SubmissionSummaryV2 } from './SubmissionSummaryV2' import { SubmissionSideNav } from '../../SubmissionSideNav' @@ -60,9 +57,7 @@ describe('SubmissionSummary', () => { ).toBeInTheDocument() }) - it.skip('renders submission updated banner', async () => { - // const submissionsWithRevisions = - // mockSubmittedHealthPlanPackageWithRevision({}) + it('renders submission updated banner', async () => { renderWithProviders( }> @@ -79,9 +74,9 @@ describe('SubmissionSummary', () => { statusCode: 200, }), fetchContractMockSuccess({ - contract: { - id: 'test-abc-123', - }, + contract: mockContractPackageSubmitted({ + status: 'RESUBMITTED', + }), }), fetchStateHealthPlanPackageWithQuestionsMockSuccess({ id: 'test-abc-123', @@ -93,7 +88,7 @@ describe('SubmissionSummary', () => { }, featureFlags: { 'link-rates': true, - }, + }, } ) @@ -110,57 +105,61 @@ describe('SubmissionSummary', () => { ) expect( await screen.findByTestId('updatedSubmissionBanner') - ).toHaveTextContent('Submitted by: aang@example.com') + ).toHaveTextContent('Submitted by: example@state.com') expect( await screen.findByTestId('updatedSubmissionBanner') - ).toHaveTextContent('Changes made: Placeholder resubmission reason') + ).toHaveTextContent('Changes made: contract submit') }) - // it('renders submission unlocked banner for CMS user', async () => { - // const submissionsWithRevisions = mockUnlockedHealthPlanPackage() - // renderWithProviders( - // - // }> - // } - // /> - // - // , - // { - // apolloProvider: { - // mocks: [ - // fetchCurrentUserMock({ - // user: mockValidCMSUser(), - // statusCode: 200, - // }), - // fetchStateHealthPlanPackageWithQuestionsMockSuccess({ - // stateSubmission: submissionsWithRevisions, - // id: '15', - // }), - // ], - // }, - // routerProvider: { - // route: '/submissions/15', - // }, - // } - // ) - // await waitFor(() => { - // expect(screen.getByTestId('unlockedBanner')).toBeInTheDocument() - // expect(screen.getByTestId('unlockedBanner')).toHaveClass( - // 'usa-alert--warning' - // ) - // expect(screen.getByTestId('unlockedBanner')).toHaveTextContent( - // /on: (0?[1-9]|[12][0-9]|3[01])\/[0-9]+\/[0-9]+\s[0-9]+:[0-9]+[a-zA-Z]+ ET/i - // ) - // expect(screen.getByTestId('unlockedBanner')).toHaveTextContent( - // 'by: bob@dmas.mn.gov' - // ) - // expect(screen.getByTestId('unlockedBanner')).toHaveTextContent( - // 'Reason for unlock: Test unlock reason' - // ) - // }) - // }) + it('renders submission unlocked banner for CMS user', async () => { + renderWithProviders( + + }> + } + /> + + , + { + apolloProvider: { + mocks: [ + fetchCurrentUserMock({ + user: mockValidCMSUser(), + statusCode: 200, + }), + fetchContractMockSuccess({ + contract: mockContractPackageUnlocked(), + }), + fetchStateHealthPlanPackageWithQuestionsMockSuccess({ + id: 'test-abc-123', + }), + ], + }, + routerProvider: { + route: '/submissions/test-abc-123', + }, + featureFlags: { + 'link-rates': true, + }, + } + ) + await waitFor(() => { + expect(screen.getByTestId('unlockedBanner')).toBeInTheDocument() + expect(screen.getByTestId('unlockedBanner')).toHaveClass( + 'usa-alert--warning' + ) + expect(screen.getByTestId('unlockedBanner')).toHaveTextContent( + /on: (0?[1-9]|[12][0-9]|3[01])\/[0-9]+\/[0-9]+\s[0-9]+:[0-9]+[a-zA-Z]+ ET/i + ) + expect(screen.getByTestId('unlockedBanner')).toHaveTextContent( + 'by: example@state.com' + ) + expect(screen.getByTestId('unlockedBanner')).toHaveTextContent( + 'Reason for unlock: unlocked for a test' + ) + }) + }) it('pulls the right version of UNLOCKED data for CMS users', async () => { renderWithProviders( @@ -192,17 +191,20 @@ describe('SubmissionSummary', () => { }, featureFlags: { 'link-rates': true, - }, + }, } ) expect(await screen.findByText('MCR-MN-0005-SNBC')).toBeInTheDocument() - const description = await screen.findByLabelText('Submission description') + const description = await screen.findByLabelText( + 'Submission description' + ) expect(description).toHaveTextContent('An initial submission') - const ratingPeriod = await screen.findByLabelText('Rating period of original rate certification') + const ratingPeriod = await screen.findByLabelText( + 'Rating period of original rate certification' + ) expect(ratingPeriod).toHaveTextContent('01/01/2020 to 01/01/2021') - }) it('renders add mccrs-id link for CMS user', async () => { @@ -237,7 +239,7 @@ describe('SubmissionSummary', () => { }, featureFlags: { 'link-rates': true, - }, + }, } ) await waitFor(() => { @@ -280,7 +282,7 @@ describe('SubmissionSummary', () => { }, featureFlags: { 'link-rates': true, - }, + }, } ) await waitFor(() => { @@ -323,7 +325,7 @@ describe('SubmissionSummary', () => { }, featureFlags: { 'link-rates': true, - }, + }, } ) await waitFor(() => { @@ -333,8 +335,7 @@ describe('SubmissionSummary', () => { }) }) - it.skip('renders submission unlocked banner for State user', async () => { - const contract = mockContractPackageSubmitted() + it('renders submission unlocked banner for State user', async () => { renderWithProviders( }> @@ -355,10 +356,7 @@ describe('SubmissionSummary', () => { id: 'test-abc-123', }), fetchContractMockSuccess({ - contract: { - ...contract, - status: 'UNLOCKED' - } + contract: mockContractPackageUnlocked(), }), ], }, @@ -367,7 +365,7 @@ describe('SubmissionSummary', () => { }, featureFlags: { 'link-rates': true, - }, + }, } ) await waitFor(() => { @@ -379,10 +377,10 @@ describe('SubmissionSummary', () => { /on: (0?[1-9]|[12][0-9]|3[01])\/[0-9]+\/[0-9]+\s[0-9]+:[0-9]+[a-zA-Z]+ ET/i ) expect(screen.getByTestId('unlockedBanner')).toHaveTextContent( - 'by: bob@dmas.mn.gov' + 'by: example@state.com' ) expect(screen.getByTestId('unlockedBanner')).toHaveTextContent( - 'Reason for unlock: Test unlock reason' + 'Reason for unlock: unlocked for a test' ) }) }) @@ -418,7 +416,7 @@ describe('SubmissionSummary', () => { id: 'test-abc-123', }), fetchContractMockSuccess({ - contract + contract, }), ], }, @@ -611,17 +609,13 @@ describe('SubmissionSummary', () => { }) describe('Submission package data display', () => { - it.skip('renders the OLD data for an unlocked submission for CMS user, ignoring unsubmitted changes from state user', async () => { - const pkg = mockUnlockedHealthPlanPackage() - - const oldPackageData = basicLockedHealthPlanFormData() - const newPackageData = basicLockedHealthPlanFormData() - - oldPackageData.submissionDescription = 'OLD_DESCRIPTION' - newPackageData.submissionDescription = 'NEW_DESCRIPTION' - - pkg.revisions[0].node.formDataProto = domainToBase64(newPackageData) - pkg.revisions[1].node.formDataProto = domainToBase64(oldPackageData) + it('renders the OLD data for an unlocked submission for CMS user, ignoring unsubmitted changes from state user', async () => { + const contract = mockContractPackageUnlocked() + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + contract.draftRevision!.formData.submissionDescription = + 'NEW_DESCRIPTION' + contract.packageSubmissions[0].contractRevision.formData.submissionDescription = + 'OLD_DESCRIPTION' renderWithProviders( @@ -642,13 +636,10 @@ describe('SubmissionSummary', () => { fetchStateHealthPlanPackageWithQuestionsMockSuccess( { id: 'test-abc-123', - stateSubmission: pkg, } ), fetchContractMockSuccess({ - contract: { - id: 'test-abc-123', - }, + contract, }), ], }, @@ -714,18 +705,7 @@ describe('SubmissionSummary', () => { ).toBeInTheDocument() }) - it.skip('extracts the correct dates from the submission and displays them in tables', async () => { - // const submission = mockSubmittedHealthPlanPackageWithRevision({ - // currentSubmitInfo: { - // updatedAt: new Date('2022-05-12T21:13:20.420Z'), - // }, - // previousSubmitInfo: { - // updatedAt: new Date('2022-04-12T21:13:20.420Z'), - // }, - // initialSubmitInfo: { - // updatedAt: new Date('2022-03-12T21:13:20.420Z'), - // }, - // }) + it('extracts the correct dates from the submission and displays them in tables', async () => { renderWithProviders( }> @@ -748,9 +728,7 @@ describe('SubmissionSummary', () => { } ), fetchContractMockSuccess({ - contract: { - id: 'test-abc-123', - }, + contract: mockContractPackageSubmitted(), }), ], }, @@ -764,20 +742,20 @@ describe('SubmissionSummary', () => { ) await waitFor(() => { const rows = screen.getAllByRole('row') - expect(rows).toHaveLength(10) + expect(rows).toHaveLength(5) expect( within(rows[0]).getByText('Date added') ).toBeInTheDocument() - expect(within(rows[1]).getByText('3/12/22')).toBeInTheDocument() - expect(within(rows[2]).getByText('5/12/22')).toBeInTheDocument() + expect(within(rows[1]).getByText('5/12/22')).toBeInTheDocument() + expect(within(rows[2]).getByText('4/12/22')).toBeInTheDocument() expect( - within(rows[5]).getByText('Date added') + within(rows[3]).getByText('Date added') ).toBeInTheDocument() - expect(within(rows[7]).getByText('3/12/22')).toBeInTheDocument() + expect(within(rows[4]).getByText('3/12/22')).toBeInTheDocument() }) }) - it.skip('disables the unlock button for an unlocked submission', async () => { + it('disables the unlock button for an unlocked submission', async () => { renderWithProviders( }> @@ -796,15 +774,19 @@ describe('SubmissionSummary', () => { }), fetchStateHealthPlanPackageWithQuestionsMockSuccess( { - id: '15', - stateSubmission: - mockUnlockedHealthPlanPackage(), + id: 'test-abc-123', } ), + fetchContractMockSuccess({ + contract: mockContractPackageUnlocked(), + }), ], }, routerProvider: { - route: '/submissions/15', + route: '/submissions/test-abc-123', + }, + featureFlags: { + 'link-rates': true, }, } ) @@ -817,56 +799,5 @@ describe('SubmissionSummary', () => { ).toBeDisabled() }) }) - - it.skip('displays unlock banner with correct data for an unlocked submission', async () => { - renderWithProviders( - - }> - } - /> - - , - { - apolloProvider: { - mocks: [ - fetchCurrentUserMock({ - user: mockValidCMSUser(), - statusCode: 200, - }), - fetchStateHealthPlanPackageWithQuestionsMockSuccess( - { - id: '15', - stateSubmission: - mockUnlockedHealthPlanPackage(), - } - ), - ], - }, - routerProvider: { - route: '/submissions/15', - }, - } - ) - - expect( - await screen.findByTestId('unlockedBanner') - ).toBeInTheDocument() - expect(await screen.findByTestId('unlockedBanner')).toHaveClass( - 'usa-alert--warning' - ) - expect( - await screen.findByTestId('unlockedBanner') - ).toHaveTextContent( - /Unlocked on: (0?[1-9]|[12][0-9]|3[01])\/[0-9]+\/[0-9]+\s[0-9]+:[0-9]+[a-zA-Z]+ ET/i - ) - expect( - await screen.findByTestId('unlockedBanner') - ).toHaveTextContent('Unlocked by: bob@dmas.mn.govUnlocked') - expect( - await screen.findByTestId('unlockedBanner') - ).toHaveTextContent('Reason for unlock: Test unlock reason') - }) }) }) diff --git a/services/app-web/src/testHelpers/apolloMocks/contractPackageDataMock.ts b/services/app-web/src/testHelpers/apolloMocks/contractPackageDataMock.ts index 3f563dbd03..c98362ab25 100644 --- a/services/app-web/src/testHelpers/apolloMocks/contractPackageDataMock.ts +++ b/services/app-web/src/testHelpers/apolloMocks/contractPackageDataMock.ts @@ -15,6 +15,7 @@ function mockContractPackageDraft( stateCode: 'MN', state: mockMNState(), stateNumber: 5, + mccrsID: undefined, draftRevision: { __typename: 'ContractRevision', submitInfo: undefined, @@ -148,6 +149,7 @@ function mockContractWithLinkedRateDraft( stateCode: 'MN', state: mockMNState(), stateNumber: 5, + mccrsID: undefined, draftRevision: { __typename: 'ContractRevision', submitInfo: undefined, @@ -322,10 +324,12 @@ function mockContractPackageSubmitted( status: 'SUBMITTED', createdAt: new Date(), updatedAt: new Date(), + initiallySubmittedAt: new Date(), id: 'test-abc-123', stateCode: 'MN', state: mockMNState(), stateNumber: 5, + mccrsID: undefined, packageSubmissions: [{ cause: 'CONTRACT_SUBMISSION', submitInfo: { @@ -343,6 +347,7 @@ function mockContractPackageSubmitted( updatedBy: 'example@state.com', updatedReason: 'contract submit' }, + unlockInfo: undefined, id: '123', formData: { programIDs: ['abbdf9b0-c49e-4c4c-bb6f-040cb7b51cce'], @@ -359,7 +364,13 @@ function mockContractPackageSubmitted( s3URL: 's3://bucketname/key/contract', sha256: 'fakesha', name: 'contract', - dateAdded: new Date() + dateAdded: new Date('2022-05-12T21:13:20.420Z') + }, + { + s3URL: 's3://bucketname/key/contract', + sha256: 'fakesha', + name: 'contract', + dateAdded: new Date('2022-04-12T21:13:20.420Z') }, ], contractDateStart: new Date(), @@ -407,7 +418,7 @@ function mockContractPackageSubmitted( s3URL: 's3://bucketname/key/rate', sha256: 'fakesha', name: 'rate', - dateAdded: new Date() + dateAdded: new Date('2022-03-12T21:13:20.420Z') }, ], supportingDocuments: [], @@ -450,10 +461,12 @@ function mockContractPackageUnlocked( status: 'UNLOCKED', createdAt: new Date(), updatedAt: new Date(), + initiallySubmittedAt: new Date(), id: 'test-abc-123', stateCode: 'MN', state: mockMNState(), stateNumber: 5, + mccrsID: '1234', draftRevision: { __typename: 'ContractRevision', submitInfo: undefined, @@ -586,7 +599,66 @@ function mockContractPackageUnlocked( updatedBy: 'example@state.com', updatedReason: 'initial submission' }, - submittedRevisions: [], + submittedRevisions: [ + { + contractName: 'MCR-MN-0005-SNBC', + createdAt: new Date('01/01/2024'), + updatedAt: new Date('12/31/2024'), + submitInfo: { + updatedAt: new Date('01/01/2024'), + updatedBy: 'example@state.com', + updatedReason: 'initial submission' + }, + unlockInfo: { + updatedAt: new Date('01/01/2024'), + updatedBy: 'example@state.com', + updatedReason: 'unlocked for a test' + }, + id: '123', + formData: { + programIDs: ['abbdf9b0-c49e-4c4c-bb6f-040cb7b51cce'], + populationCovered: 'MEDICAID', + submissionType: 'CONTRACT_AND_RATES', + riskBasedContract: true, + submissionDescription: 'An initial submission', + supportingDocuments: [], + stateContacts: [], + contractType: 'AMENDMENT', + contractExecutionStatus: 'EXECUTED', + contractDocuments: [ + { + s3URL: 's3://bucketname/key/contract', + sha256: 'fakesha', + name: 'contract', + dateAdded: new Date() + }, + ], + contractDateStart: new Date('01/01/2023'), + contractDateEnd: new Date('01/01/2024'), + managedCareEntities: ['MCO'], + federalAuthorities: ['STATE_PLAN'], + inLieuServicesAndSettings: true, + modifiedBenefitsProvided: true, + modifiedGeoAreaServed: false, + modifiedMedicaidBeneficiaries: true, + modifiedRiskSharingStrategy: true, + modifiedIncentiveArrangements: false, + modifiedWitholdAgreements: false, + modifiedStateDirectedPayments: true, + modifiedPassThroughPayments: true, + modifiedPaymentsForMentalDiseaseInstitutions: false, + modifiedMedicalLossRatioStandards: true, + modifiedOtherFinancialPaymentIncentive: false, + modifiedEnrollmentProcess: true, + modifiedGrevienceAndAppeal: false, + modifiedNetworkAdequacyStandards: true, + modifiedLengthOfContract: false, + modifiedNonRiskPaymentArrangements: true, + statutoryRegulatoryAttestation: true, + statutoryRegulatoryAttestationDescription: "everything meets regulatory attestation" + } + } + ], contractRevision: { contractName: 'MCR-MN-0005-SNBC', createdAt: new Date('01/01/2024'), @@ -596,6 +668,11 @@ function mockContractPackageUnlocked( updatedBy: 'example@state.com', updatedReason: 'initial submission' }, + unlockInfo: { + updatedAt: new Date('01/01/2024'), + updatedBy: 'example@state.com', + updatedReason: 'unlocked' + }, id: '123', formData: { programIDs: ['abbdf9b0-c49e-4c4c-bb6f-040cb7b51cce'],