diff --git a/services/app-api/src/resolvers/rate/submitRate.test.ts b/services/app-api/src/resolvers/rate/submitRate.test.ts index 90a2458a86..aed1fc89b0 100644 --- a/services/app-api/src/resolvers/rate/submitRate.test.ts +++ b/services/app-api/src/resolvers/rate/submitRate.test.ts @@ -194,8 +194,6 @@ describe('submitRate', () => { }) it('returns the latest linked contracts', async () => { - l - const stateServer = await constructTestPostgresServer({ ldService, }) 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 5c9b257332..a57b6df58d 100644 --- a/services/app-web/src/pages/StateSubmission/RateDetails/RateDetails.test.tsx +++ b/services/app-web/src/pages/StateSubmission/RateDetails/RateDetails.test.tsx @@ -32,9 +32,9 @@ import { fillOutIndexRate, } from '../../../testHelpers/jestRateHelpers' import { Rate } from '../../../gen/gqlClient' -import selectEvent from 'react-select-event' describe('RateDetails', () => { + // BRING THESE TESTS BACK WHEN WE RE-p IMPLEMENT SINGLE RATE EDIT /* eslint-disable jest/no-disabled-tests, jest/expect-expect */ describe.skip('handles edit of a single rate', () => { it('renders without errors', async () => { @@ -72,6 +72,104 @@ describe('RateDetails', () => { expect(optionalLabels).toHaveLength(1) }) + it('progressively disclose new rate form fields as expected', async () => { + renderWithProviders(, { + apolloProvider: { + mocks: [ + fetchCurrentUserMock({ + statusCode: 200, + }), + ], + }, + }) + + expect( + screen.getByText('Programs this rate certification covers') + ).toBeInTheDocument() + expect( + screen.getByText('Rate certification type') + ).toBeInTheDocument() + screen.getByLabelText('New rate certification').click() + expect( + screen.getByText( + 'Does the actuary certify capitation rates specific to each rate cell or a rate range?' + ) + ).toBeInTheDocument() + screen + .getByLabelText( + 'Certification of capitation rates specific to each rate cell' + ) + .click() + const input = screen.getByLabelText( + 'Upload one rate certification document' + ) + await userEvent.upload(input, [TEST_DOC_FILE]) + const hasSharedRateFieldset = screen + .getByText( + /Was this rate certification included with another submission/ + ) + .closest('fieldset') + await userEvent.click( + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + within(hasSharedRateFieldset!).getByLabelText(/No/i) + ) + + // check that now we can see hidden things + await waitFor(() => { + expect(screen.queryByText('Rating period')).toBeInTheDocument() + expect(screen.queryByText('Rating period')).toBeInTheDocument() + expect(screen.queryByText('Start date')).toBeInTheDocument() + expect(screen.queryByText('End date')).toBeInTheDocument() + expect(screen.queryByText('Date certified')).toBeInTheDocument() + expect(screen.queryAllByTestId('errorMessage')).toHaveLength(0) + }) + // click "continue" + const continueButton = screen.getByRole('button', { + name: 'Continue', + }) + + fireEvent.click(continueButton) + + // check for expected errors + await waitFor(() => { + expect(screen.queryAllByTestId('errorMessage')).toHaveLength(7) + expect( + screen.queryAllByText( + 'You must select which rate(s) are included in this certification' + ) + ).toHaveLength(2) + expect( + screen.queryByText( + 'You must provide a start and an end date' + ) + ).toBeInTheDocument() + expect( + screen.queryAllByText( + 'You must enter the date the document was certified' + ) + ).toHaveLength(2) + expect( + screen.queryAllByText('You must provide a name') + ).toHaveLength(2) + expect( + screen.queryAllByText('You must provide a title/role') + ).toHaveLength(2) + expect( + screen.queryAllByText('You must provide an email address') + ).toHaveLength(2) + expect( + screen.queryAllByText('You must select an actuarial firm') + ).toHaveLength(2) + }) + + await fillOutFirstRate(screen) + + //wait for all errors to clear + await waitFor(() => + expect(screen.queryAllByTestId('errorMessage')).toHaveLength(0) + ) + }) + describe('submit', () => { it('enabled on initial load but disabled with alert if valid rate cert file replaced with invalid file', async () => { const rateID = 'abc-123' @@ -246,136 +344,6 @@ describe('RateDetails', () => { 'Was this rate certification included with another submission?' ) ).toBeInTheDocument() - screen - .getByLabelText( - 'Certification of capitation rates specific to each rate cell' - ) - .click() - const input = screen.getByLabelText( - 'Upload one rate certification document' - ) - await userEvent.upload(input, [TEST_DOC_FILE]) - const hasSharedRateFieldset = screen - .getByText( - /Was this rate certification included with another submission/ - ) - .closest('fieldset') - await userEvent.click( - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - within(hasSharedRateFieldset!).getByLabelText(/No/i) - ) - - // check that now we can see hidden things - await waitFor(() => { - expect(screen.queryByText('Rating period')).toBeInTheDocument() - expect(screen.queryByText('Rating period')).toBeInTheDocument() - expect(screen.queryByText('Start date')).toBeInTheDocument() - expect(screen.queryByText('End date')).toBeInTheDocument() - expect(screen.queryByText('Date certified')).toBeInTheDocument() - expect(screen.queryAllByTestId('errorMessage')).toHaveLength(0) - }) - // click "continue" - const continueButton = screen.getByRole('button', { - name: 'Continue', - }) - - fireEvent.click(continueButton) - - // check for expected errors - await waitFor(() => { - expect(screen.queryAllByTestId('errorMessage')).toHaveLength(7) - expect( - screen.queryAllByText( - 'You must select which rate(s) are included in this certification' - ) - ).toHaveLength(2) - expect( - screen.queryByText( - 'You must provide a start and an end date' - ) - ).toBeInTheDocument() - expect( - screen.queryAllByText( - 'You must enter the date the document was certified' - ) - ).toHaveLength(2) - expect( - screen.queryAllByText('You must provide a name') - ).toHaveLength(2) - expect( - screen.queryAllByText('You must provide a title/role') - ).toHaveLength(2) - expect( - screen.queryAllByText('You must provide an email address') - ).toHaveLength(2) - expect( - screen.queryAllByText('You must select an actuarial firm') - ).toHaveLength(2) - }) - - await fillOutFirstRate(screen) - - //wait for all errors to clear - await waitFor(() => - expect(screen.queryAllByTestId('errorMessage')).toHaveLength(0) - ) - }) - - it('displays program options based on current user state', async () => { - const mockUser = { - __typename: 'StateUser' as const, - role: 'STATE_USER', - name: 'Sheena in Minnesota', - email: 'Sheena@dmas.mn.gov', - state: { - name: 'Minnesota', - code: 'MN', - programs: [ - { - id: 'first', - name: 'Program 1', - fullName: 'Program 1', - isRateProgram: false, - }, - { - id: 'second', - name: 'Program Test', - fullName: 'Program Test', - isRateProgram: false, - }, - { - id: 'third', - name: 'Program 3', - fullName: 'Program 3', - isRateProgram: false, - }, - ], - }, - } - - renderWithProviders(, { - apolloProvider: { - mocks: [ - fetchCurrentUserMock({ - user: mockUser, - statusCode: 200, - }), - ], - }, - }) - const combobox = await screen.findByRole('combobox') - - selectEvent.openMenu(combobox) - - await waitFor(() => { - expect(screen.getByText('Program 3')).toBeInTheDocument() - }) - - await selectEvent.select(combobox, 'Program 1') - selectEvent.openMenu(combobox) - await selectEvent.select(combobox, 'Program 3') - - // in react-select, only items that are selected have a "remove item" label expect( screen.queryByText('Upload one rate certification document') ).not.toBeInTheDocument() @@ -1436,7 +1404,9 @@ describe('RateDetails', () => { screen.getAllByText('You must upload a rate certification') ).toHaveLength(2) expect( - screen.getAllByText('You must select a program') + screen.getAllByText( + 'You must select which rate(s) are included in this certification' + ) ).toHaveLength(2) expect( screen.getAllByText('You must choose a rate certification type') diff --git a/services/app-web/src/pages/SubmissionSummary/SubmissionSummary.test.tsx b/services/app-web/src/pages/SubmissionSummary/SubmissionSummary.test.tsx index 9fb6bd2223..169822592d 100644 --- a/services/app-web/src/pages/SubmissionSummary/SubmissionSummary.test.tsx +++ b/services/app-web/src/pages/SubmissionSummary/SubmissionSummary.test.tsx @@ -824,6 +824,11 @@ describe('SubmissionSummary', () => { user: mockValidCMSUser(), statusCode: 200, }), + fetchContractMockSuccess({ + contract: mockContractPackageUnlocked({ + id: '15', + }), + }), ], }, routerProvider: { @@ -845,10 +850,10 @@ describe('SubmissionSummary', () => { ) expect( await screen.findByTestId('unlockedBanner') - ).toHaveTextContent('Unlocked by: bob@dmas.mn.govUnlocked') + ).toHaveTextContent('Unlocked by: cms@example.com') expect( await screen.findByTestId('unlockedBanner') - ).toHaveTextContent('Reason for unlock: Test unlock reason') + ).toHaveTextContent('Reason for unlock: unlocked for a test') }) }) })