Skip to content

Commit

Permalink
Wip to show what I'm doing
Browse files Browse the repository at this point in the history
  • Loading branch information
haworku committed Feb 1, 2024
1 parent 9423fc2 commit 9ff2174
Show file tree
Hide file tree
Showing 10 changed files with 125 additions and 182 deletions.
2 changes: 1 addition & 1 deletion services/app-web/src/formHelpers/formatters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ const formatDocumentsForForm = ({
name: doc.name,
key: key,
s3URL: doc.s3URL,
sha256: doc.sha256,
sha256: doc.sha256 ?? undefined,
status: 'UPLOAD_COMPLETE',
}
}) || []
Expand Down
11 changes: 9 additions & 2 deletions services/app-web/src/pages/App/AppRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ import {
UploadQuestions,
} from '../QuestionResponse'
import { GraphQLExplorer } from '../GraphQLExplorer/GraphQLExplorer'
import { RateSummary } from '../SubmissionSummary/RateSummary'
import { RateEdit } from '../RateEdit/RateEdit'
import { RateSummary } from '../RateSummary'
import { RateDetailsV2 } from '../StateSubmission/RateDetails/RateDetailsV2'
import { RateEdit } from '../RateSubmission/RateEdit/RateEdit'

function componentForAuthMode(
authMode: AuthModeType
Expand Down Expand Up @@ -108,10 +109,16 @@ const StateUserRoutes = ({
element={<NewStateSubmissionForm />}
/>
{showRatePages && (
<>
<Route
path={RoutesRecord.RATES_SUMMARY}
element={<RateSummary />}
/>
<Route
path={RoutesRecord.RATE_EDIT}
element={<RateEdit />}
/>
</>
)}
<Route element={<SubmissionSideNav />}>
{showQuestionResponse && (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { screen, waitFor } from '@testing-library/react'
import { renderWithProviders } from "../../testHelpers"
import { renderWithProviders } from "../../../testHelpers"
import { RateEdit } from "./RateEdit"
import { fetchCurrentUserMock, fetchRateMockSuccess, mockValidStateUser } from "../../testHelpers/apolloMocks"
import { RoutesRecord } from '../../constants'
import { fetchCurrentUserMock, fetchRateMockSuccess, mockValidStateUser } from "../../../testHelpers/apolloMocks"
import { RoutesRecord } from '../../../constants'
import { Route, Routes } from 'react-router-dom'

// Wrap test component in some top level routes to allow getParams to be tested
Expand Down Expand Up @@ -33,8 +33,8 @@ describe('RateEdit', () => {
routerProvider: {
route: '/rates/1337/edit'
},
featureFlags: {
'rate-edit-unlock': true
featureFlags: {
'rate-edit-unlock': true
}
})

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React from "react";
import { useNavigate, useParams } from "react-router-dom";
import { useFetchRateQuery } from "../../gen/gqlClient";
import { useFetchRateQuery } from "../../../gen/gqlClient";
import { GridContainer } from "@trussworks/react-uswds";
import { Loading } from "../../components";
import { GenericErrorPage } from "../Errors/GenericErrorPage";
import { RateDetailsV2 } from "../StateSubmission/RateDetails/RateDetailsV2";
import { Loading } from "../../../components";
import { GenericErrorPage } from "../../Errors/GenericErrorPage";
import { RateDetailsV2 } from "../../StateSubmission/RateDetails/RateDetailsV2";

type RouteParams = {
id: string
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { screen, waitFor } from '@testing-library/react'
import { renderWithProviders, testS3Client } from '../../../testHelpers'
import { renderWithProviders, testS3Client } from '../../testHelpers'
import {
fetchCurrentUserMock,
fetchRateMockSuccess,
mockValidCMSUser,
mockValidStateUser,
} from '../../../testHelpers/apolloMocks'
} from '../../testHelpers/apolloMocks'
import { RateSummary } from './RateSummary'
import { RoutesRecord } from '../../../constants'
import { RoutesRecord } from '../../constants'
import { Route, Routes } from 'react-router-dom'
import { RateEdit } from '../../RateEdit/RateEdit'
import { RateEdit } from '../RateSubmission/RateEdit/RateEdit'

// Wrap test component in some top level routes to allow getParams to be tested
const wrapInRoutes = (children: React.ReactNode) => {
Expand Down Expand Up @@ -146,15 +146,15 @@ describe('RateSummary', () => {
it('redirects to RateEdit component from RateSummary without errors for unlocked rate', async () => {
renderWithProviders(
<Routes>
<Route
path={RoutesRecord.RATES_SUMMARY}
element={<RateSummary />}
<Route
path={RoutesRecord.RATES_SUMMARY}
element={<RateSummary />}
/>
<Route
path={RoutesRecord.RATE_EDIT}
element={<RateEdit />}
<Route
path={RoutesRecord.RATE_EDIT}
element={<RateEdit />}
/>
</Routes>,
</Routes>,
{
apolloProvider: {
mocks: [
Expand All @@ -168,8 +168,8 @@ describe('RateSummary', () => {
routerProvider: {
route: '/rates/1337'
},
featureFlags: {
'rate-edit-unlock': true
featureFlags: {
'rate-edit-unlock': true
}
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ import { GridContainer, Icon, Link } from '@trussworks/react-uswds'
import React, { useEffect, useState } from 'react'
import { NavLink, useNavigate, useParams } from 'react-router-dom'

import { Loading } from '../../../components'
import { usePage } from '../../../contexts/PageContext'
import { useFetchRateQuery } from '../../../gen/gqlClient'
import { Loading } from '../../components'
import { usePage } from '../../contexts/PageContext'
import { useFetchRateQuery } from '../../gen/gqlClient'
import styles from '../SubmissionSummary.module.scss'
import { GenericErrorPage } from '../../Errors/GenericErrorPage'
import { RoutesRecord } from '../../../constants'
import { SingleRateSummarySection } from '../../../components/SubmissionSummarySection/RateDetailsSummarySection/SingleRateSummarySection'
import { useAuth } from '../../../contexts/AuthContext'
import { GenericErrorPage } from '../Errors/GenericErrorPage'
import { RoutesRecord } from '../../constants'
import { SingleRateSummarySection } from '../../components/SubmissionSummarySection/RateDetailsSummarySection/SingleRateSummarySection'
import { useAuth } from '../../contexts/AuthContext'

type RouteParams = {
id: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ const SingleRateCertSchema = (_activeFeatureFlags: FeatureFlagSettings) =>
rateDocuments: validateFileItemsListSingleUpload({ required: true }),
supportingDocuments: validateFileItemsList({ required: false }),
hasSharedRateCert: Yup.string().defined('You must select yes or no'),
packagesWithSharedRateCerts: Yup.array()
packagesWithSharedRateCerts: _activeFeatureFlags['rate-edit-unlock']? Yup.array()
.when('hasSharedRateCert', {
is: 'YES',
then: Yup.array().min(
1,
'You must select at least one submission'
),
})
.required(),
.required(): Yup.array().optional(),
rateProgramIDs: Yup.array().min(1, 'You must select a program'),
rateType: Yup.string().defined(
'You must choose a rate certification type'
Expand Down
Loading

0 comments on commit 9ff2174

Please sign in to comment.