Skip to content

Commit

Permalink
[PRMDR-873] address sonarcloud issue
Browse files Browse the repository at this point in the history
  • Loading branch information
joefong-nhs committed May 17, 2024
1 parent 63aec83 commit 63c8af8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ import { PatientDetails } from '../../../../types/generic/patientDetails';
import usePatient from '../../../../helpers/hooks/usePatient';
import uploadDocuments, { uploadDocumentToS3 } from '../../../../helpers/requests/uploadDocuments';
import { useState } from 'react';
import { createMemoryHistory } from 'history';
import { SUBMISSION_STATE } from '../../../../types/pages/documentSearchResultsPage/types';
import { routes } from '../../../../types/generic/routes';

const mockedUseNavigate = jest.fn();
Expand Down
6 changes: 4 additions & 2 deletions app/src/components/blocks/_arf/selectStage/SelectStage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ function SelectStage({ setDocuments, setStage, documents }: Props) {
const baseHeaders = useBaseAPIHeaders();
const navigate = useNavigate();
const arfInputRef = useRef<HTMLInputElement | null>(null);
// const lgInputRef = useRef<HTMLInputElement | null>(null); // NO SONAR
// const lgInputRef = useRef<HTMLInputElement | null>(null); // NOSONAR
const patientDetails = usePatient();
const nhsNumber: string = patientDetails?.nhsNumber ?? '';
const mergedDocuments = [...arfDocuments, ...lgDocuments];
const hasFileInput = mergedDocuments.length > 0;

const { handleSubmit, control, formState, setError } = useForm();

// const lgController = useController(lloydGeorgeFormConfig(control)); // NO SONAR
// const lgController = useController(lloydGeorgeFormConfig(control)); // NOSONAR
const arfController = useController(ARFFormConfig(control));

const submitDocuments = async () => {
Expand Down Expand Up @@ -103,12 +103,14 @@ function SelectStage({ setDocuments, setStage, documents }: Props) {
if (error.response?.status === 403) {
navigate(routes.SESSION_EXPIRED);
} else if (isMock(error)) {
/* istanbul ignore next */
setDocuments((prevState) =>
prevState.map((doc) => ({
...doc,
state: DOCUMENT_UPLOAD_STATE.SUCCEEDED,
})),
);
/* istanbul ignore next */
setStage(UPLOAD_STAGE.Complete);
} else {
navigate(routes.SERVER_ERROR + errorToParams(error));
Expand Down

0 comments on commit 63c8af8

Please sign in to comment.