{
- return (
-
-
- }
- />
-
- )
-}
-
-describe.skip('ReviewSubmit', () => {
- it.skip('renders without errors', async () => {
- renderWithProviders(wrapInRoutes(),
+describe('ReviewSubmit', () => {
+ it('renders without errors', async () => {
+ renderWithProviders(
+
+ }
+ />
+ ,
{
apolloProvider: {
mocks: [
fetchCurrentUserMock({ statusCode: 200 }),
- fetchContractMockSuccess({ contract: { id: 'test-abc-123' } }),
+ fetchContractMockSuccess({
+ contract: {
+ id: 'test-abc-123',
+ }
+ }),
],
},
routerProvider: {
route: '/submissions/test-abc-123/edit/review-and-submit',
- }
+ },
+ featureFlags: {
+ 'link-rates': true,
+ },
})
+
await waitFor(() => {
expect(
screen.getByRole('heading', { name: 'Contract details' })
- ).toBeInTheDocument()
+ ).toBeInTheDocument()
})
-
})
- it.skip('displays edit buttons for every section', async () => {
- renderWithProviders(, {
- apolloProvider: {
- mocks: [fetchCurrentUserMock({ statusCode: 200 })],
- },
- })
+ it('displays edit buttons for every section', async () => {
+ renderWithProviders(
+
+ }
+ />
+ ,
+ {
+ apolloProvider: {
+ mocks: [
+ fetchCurrentUserMock({ statusCode: 200 }),
+ fetchContractMockSuccess({
+ contract: {
+ id: 'test-abc-123',
+ }
+ }),
+ ],
+ },
+ routerProvider: {
+ route: '/submissions/test-abc-123/edit/review-and-submit',
+ },
+ featureFlags: {
+ 'link-rates': true,
+ },
+ })
await waitFor(() => {
const sectionHeadings = screen.queryAllByRole('heading', {
@@ -64,12 +83,32 @@ describe.skip('ReviewSubmit', () => {
})
})
- it.skip('does not display zip download buttons', async () => {
- renderWithProviders(, {
- apolloProvider: {
- mocks: [fetchCurrentUserMock({ statusCode: 200 })],
- },
- })
+ it('does not display zip download buttons', async () => {
+ renderWithProviders(
+
+ }
+ />
+ ,
+ {
+ apolloProvider: {
+ mocks: [
+ fetchCurrentUserMock({ statusCode: 200 }),
+ fetchContractMockSuccess({
+ contract: {
+ id: 'test-abc-123',
+ }
+ }),
+ ],
+ },
+ routerProvider: {
+ route: '/submissions/test-abc-123/edit/review-and-submit',
+ },
+ featureFlags: {
+ 'link-rates': true,
+ },
+ })
await waitFor(() => {
const bulkDownloadButtons = screen.queryAllByRole('button', {
@@ -79,12 +118,30 @@ describe.skip('ReviewSubmit', () => {
})
})
- it.skip('renders info from a DraftSubmission', async () => {
- renderWithProviders(, {
- apolloProvider: {
- mocks: [fetchCurrentUserMock({ statusCode: 200 })],
- },
- })
+ it('renders info from a draft contract', async () => {
+ renderWithProviders(
+
+ }
+ />
+ ,
+ {
+ apolloProvider: {
+ mocks: [
+ fetchCurrentUserMock({ statusCode: 200 }),
+ fetchContractMockSuccess({
+ contract: {id: 'test-abc-123' }
+ }),
+ ],
+ },
+ routerProvider: {
+ route: '/submissions/test-abc-123/edit/review-and-submit',
+ },
+ featureFlags: {
+ 'link-rates': true,
+ },
+ })
await waitFor(() => {
expect(
@@ -104,7 +161,7 @@ describe.skip('ReviewSubmit', () => {
expect(sectionHeadings.length).toBeGreaterThanOrEqual(
editButtons.length
)
-
+ screen.debug()
const submissionDescription =
screen.queryByText('A real submission')
expect(submissionDescription).toBeInTheDocument()
diff --git a/services/app-web/src/pages/StateSubmission/ReviewSubmit/V2/ReviewSubmit/ReviewSubmitV2.tsx b/services/app-web/src/pages/StateSubmission/ReviewSubmit/V2/ReviewSubmit/ReviewSubmitV2.tsx
index 52ae9ebef0..41f155a001 100644
--- a/services/app-web/src/pages/StateSubmission/ReviewSubmit/V2/ReviewSubmit/ReviewSubmitV2.tsx
+++ b/services/app-web/src/pages/StateSubmission/ReviewSubmit/V2/ReviewSubmit/ReviewSubmitV2.tsx
@@ -9,11 +9,14 @@ import { DynamicStepIndicator } from '../../../../../components'
import { PageActionsContainer } from '../../../PageActions'
import styles from '../../../ReviewSubmit/ReviewSubmit.module.scss'
import { ActionButton } from '../../../../../components/ActionButton'
-import { useStatePrograms } from '../../../../../hooks/useStatePrograms'
+import { useStatePrograms } from '../../../../../hooks'
import {
RoutesRecord,
STATE_SUBMISSION_FORM_ROUTES,
} from '../../../../../constants'
+import {
+ getLastContractSubmission,
+} from '../../../../../gqlHelpers/contractsAndRates'
import { useAuth } from '../../../../../contexts/AuthContext'
import { RateDetailsSummarySectionV2 } from './RateDetailsSummarySectionV2'
import { ContactsSummarySection } from './ContactsSummarySectionV2'
@@ -46,7 +49,7 @@ export const ReviewSubmitV2 = (): React.ReactElement => {
'PROGRAMMING ERROR: id param not set in state submission form.'
)
}
-
+
const { data, loading, error } = useFetchContractQuery({
variables: {
input: {
@@ -57,7 +60,6 @@ export const ReviewSubmitV2 = (): React.ReactElement => {
})
const contract = data?.fetchContract.contract
-
useEffect(() => {
updateHeading({
customHeading: contract?.draftRevision?.contractName,
@@ -93,18 +95,18 @@ export const ReviewSubmitV2 = (): React.ReactElement => {
contract.draftRates && contract.draftRates.length > 0
const contractFormData =
contract.draftRevision?.formData ||
- contract.packageSubmissions[0].contractRevision.formData
- const programIDs = contractFormData.programIDs
+ getLastContractSubmission(contract)?.contractRevision.formData
+ const programIDs = contractFormData?.programIDs
const programs = statePrograms.filter((program) =>
- programIDs.includes(program.id)
+ programIDs?.includes(program.id)
)
- const submissionName = packageName(
+ const submissionName = contractFormData && packageName(
contract.stateCode,
contract.stateNumber,
contractFormData.programIDs,
programs
- )
+ ) || ''
return (
<>
@@ -120,13 +122,14 @@ export const ReviewSubmitV2 = (): React.ReactElement => {
This is the V2 version of the Review Submit Page
-
-
+ )}
contractFormData.programIDs.includes(p.id))
+ .filter((p) => contractFormData?.programIDs.includes(p.id))
.map((p) => p.name)
const isSubmitted = contract.status === 'SUBMITTED'
// const isRiskBasedContract = contractFormData.riskBasedContract ===
@@ -56,7 +59,6 @@ export const SubmissionTypeSummarySectionV2 = ({
>
{headerChildComponent && headerChildComponent}
-
{isSubmitted && !isPreviousSubmission && (
@@ -71,7 +73,6 @@ export const SubmissionTypeSummarySectionV2 = ({
}
/>
- <>>
)}
@@ -81,7 +82,8 @@ export const SubmissionTypeSummarySectionV2 = ({
explainMissingData={!isSubmitted}
children={programNames}
/>
-
-
- {contractFormData.riskBasedContract !== null && (
+ )}
+ {contractFormData && contractFormData?.riskBasedContract !== null && (
)}
-
+ )}
-
+ )}