From 6b29964ca127d5f33ffb96c04bfcb9cf72e8adfa Mon Sep 17 00:00:00 2001 From: jack-nhs Date: Fri, 20 Dec 2024 09:35:18 +0000 Subject: [PATCH] Prmp 1182 - Remove number of files line from available records page (#485) * removes number of files and size of files from within record card * adds number of files downloading back * fixes tests * remove unnessecary import * remove unnessecary import * remove unnessecary import * remove unnessecary import --------- Co-authored-by: Jack Sutton Co-authored-by: steph-torres-nhs --- .../download_lloyd_george_workflow.cy.js | 6 ------ .../view_lloyd_george_is_bsol_workflow.cy.js | 3 +-- .../LloydGeorgeDownloadStage.test.tsx | 2 +- .../LloydGeorgeDownloadStage.tsx | 5 +---- .../LloydGeorgeRecordDetails.test.tsx | 8 ------- .../LloydGeorgeRecordDetails.tsx | 13 +----------- .../LloydGeorgeViewRecordStage.test.tsx | 6 ------ .../LloydGeorgeViewRecordStage.tsx | 16 ++------------ .../LloydGeorgeRecordPage.test.tsx | 21 ------------------- 9 files changed, 6 insertions(+), 74 deletions(-) diff --git a/app/cypress/e2e/0-ndr-core-tests/gp_user_workflows/download_lloyd_george_workflow.cy.js b/app/cypress/e2e/0-ndr-core-tests/gp_user_workflows/download_lloyd_george_workflow.cy.js index 972cf3c4a..802440d69 100644 --- a/app/cypress/e2e/0-ndr-core-tests/gp_user_workflows/download_lloyd_george_workflow.cy.js +++ b/app/cypress/e2e/0-ndr-core-tests/gp_user_workflows/download_lloyd_george_workflow.cy.js @@ -171,9 +171,6 @@ describe('GP Workflow: View Lloyd George record', () => { // Assert contents of page when downloading cy.getByTestId('lloyd-george-download-header').should('exist'); cy.getByTestId('cancel-download-link').should('exist'); - cy.getByTestId('download-file-header-' + testFiles.length + '-files').should( - 'exist', - ); // Assert contents of page after download cy.wait('@documentManifestCompleted'); @@ -225,7 +222,6 @@ describe('GP Workflow: View Lloyd George record', () => { cy.title().should('eq', downloadingPageTitle); // Assert contents of page when downloading cy.getByTestId('lloyd-george-download-header').should('exist'); - cy.getByTestId('download-file-header-2-files').should('exist'); cy.getByTestId('cancel-download-link').should('exist'); @@ -289,8 +285,6 @@ describe('GP Workflow: View Lloyd George record', () => { cy.title().should('eq', downloadingPageTitle); // Assert contents of page when downloading cy.getByTestId('lloyd-george-download-header').should('exist'); - cy.getByTestId('download-file-header-1-files').should('exist'); - cy.getByTestId('cancel-download-link').should('exist'); // Assert contents of page after download diff --git a/app/cypress/e2e/0-ndr-core-tests/gp_user_workflows/view_lloyd_george_is_bsol_workflow.cy.js b/app/cypress/e2e/0-ndr-core-tests/gp_user_workflows/view_lloyd_george_is_bsol_workflow.cy.js index d60e248df..f9f13127f 100644 --- a/app/cypress/e2e/0-ndr-core-tests/gp_user_workflows/view_lloyd_george_is_bsol_workflow.cy.js +++ b/app/cypress/e2e/0-ndr-core-tests/gp_user_workflows/view_lloyd_george_is_bsol_workflow.cy.js @@ -95,8 +95,7 @@ describe('GP Workflow: View Lloyd George record', () => { assertPatientInfo(); cy.getByTestId('pdf-card') .should('include.text', 'Lloyd George record') - .should('include.text', 'Last updated: 09 October 2023 at 15:41:38') - .should('include.text', '12 files | File size: 502 KB | File format: PDF'); + .should('include.text', 'Last updated: 09 October 2023 at 15:41:38'); cy.getByTestId('pdf-viewer').should('be.visible'); // Act - open full screen view diff --git a/app/src/components/blocks/_lloydGeorge/lloydGeorgeDownloadStage/LloydGeorgeDownloadStage.test.tsx b/app/src/components/blocks/_lloydGeorge/lloydGeorgeDownloadStage/LloydGeorgeDownloadStage.test.tsx index 98869324b..92712f6d7 100644 --- a/app/src/components/blocks/_lloydGeorge/lloydGeorgeDownloadStage/LloydGeorgeDownloadStage.test.tsx +++ b/app/src/components/blocks/_lloydGeorge/lloydGeorgeDownloadStage/LloydGeorgeDownloadStage.test.tsx @@ -220,9 +220,9 @@ describe('LloydGeorgeDownloadStage', () => { const renderComponent = (history: MemoryHistory, propsOverride?: Partial) => { const props: Omit = { - numberOfFiles: mockPdf.numberOfFiles, deleteAfterDownload: false, ...propsOverride, + numberOfFiles: mockPdf.numberOfFiles, }; return render( diff --git a/app/src/components/blocks/_lloydGeorge/lloydGeorgeDownloadStage/LloydGeorgeDownloadStage.tsx b/app/src/components/blocks/_lloydGeorge/lloydGeorgeDownloadStage/LloydGeorgeDownloadStage.tsx index ae802cba1..d43a23340 100644 --- a/app/src/components/blocks/_lloydGeorge/lloydGeorgeDownloadStage/LloydGeorgeDownloadStage.tsx +++ b/app/src/components/blocks/_lloydGeorge/lloydGeorgeDownloadStage/LloydGeorgeDownloadStage.tsx @@ -41,7 +41,7 @@ function LloydGeorgeDownloadStage({ filename: '', }); const linkRef = useRef(null); - + const pageDownloadCountId = 'download-file-header-' + numberOfFiles + '-files'; const mounted = useRef(false); const navigate = useNavigate(); const { mockLocal } = useConfig(); @@ -49,8 +49,6 @@ function LloydGeorgeDownloadStage({ const nhsNumber = patientDetails?.nhsNumber ?? ''; const [delayTimer, setDelayTimer] = useState(); - const pageDownloadCountId = 'download-file-header-' + numberOfFiles + '-files'; - const progressTimer = useMemo(() => { return new FakeProgress({ timeConstant: timeToComplete, @@ -145,7 +143,6 @@ function LloydGeorgeDownloadStage({ navigate, mockLocal, selectedDocuments, - numberOfFiles, ]); const pageHeader = 'Downloading documents'; diff --git a/app/src/components/blocks/_lloydGeorge/lloydGeorgeRecordDetails/LloydGeorgeRecordDetails.test.tsx b/app/src/components/blocks/_lloydGeorge/lloydGeorgeRecordDetails/LloydGeorgeRecordDetails.test.tsx index 8f095c460..d25188220 100644 --- a/app/src/components/blocks/_lloydGeorge/lloydGeorgeRecordDetails/LloydGeorgeRecordDetails.test.tsx +++ b/app/src/components/blocks/_lloydGeorge/lloydGeorgeRecordDetails/LloydGeorgeRecordDetails.test.tsx @@ -1,7 +1,6 @@ import { render, screen } from '@testing-library/react'; import LgRecordDetails, { Props } from './LloydGeorgeRecordDetails'; import { buildLgSearchResult } from '../../../../helpers/test/testBuilders'; -import formatFileSize from '../../../../helpers/utils/formatFileSize'; const mockPdf = buildLgSearchResult(); @@ -19,11 +18,6 @@ describe('LloydGeorgeRecordDetails', () => { renderComponent(); expect(screen.getByText(`Last updated: ${mockPdf.lastUpdated}`)).toBeInTheDocument(); - expect(screen.getByText(`${mockPdf.numberOfFiles} files`)).toBeInTheDocument(); - expect( - screen.getByText(`File size: ${formatFileSize(mockPdf.totalFileSizeInBytes)}`), - ).toBeInTheDocument(); - expect(screen.getByText('File format: PDF')).toBeInTheDocument(); }); }); }); @@ -31,8 +25,6 @@ describe('LloydGeorgeRecordDetails', () => { const renderComponent = (propsOverride?: Partial) => { const props: Props = { lastUpdated: mockPdf.lastUpdated, - numberOfFiles: mockPdf.numberOfFiles, - totalFileSizeInBytes: mockPdf.totalFileSizeInBytes, ...propsOverride, }; return render(); diff --git a/app/src/components/blocks/_lloydGeorge/lloydGeorgeRecordDetails/LloydGeorgeRecordDetails.tsx b/app/src/components/blocks/_lloydGeorge/lloydGeorgeRecordDetails/LloydGeorgeRecordDetails.tsx index 9105d05e0..3042f63d0 100644 --- a/app/src/components/blocks/_lloydGeorge/lloydGeorgeRecordDetails/LloydGeorgeRecordDetails.tsx +++ b/app/src/components/blocks/_lloydGeorge/lloydGeorgeRecordDetails/LloydGeorgeRecordDetails.tsx @@ -1,27 +1,16 @@ import React from 'react'; -import formatFileSize from '../../../../helpers/utils/formatFileSize'; export type Props = { lastUpdated: string; - numberOfFiles: number; - totalFileSizeInBytes: number; }; -function LloydGeorgeRecordDetails({ lastUpdated, numberOfFiles, totalFileSizeInBytes }: Props) { +function LloydGeorgeRecordDetails({ lastUpdated }: Props) { return (
Last updated: {lastUpdated}
-
- {numberOfFiles} files - {' | '} - File size: {formatFileSize(totalFileSizeInBytes)} - {' | '} - File format: PDF - {' |'} -
); diff --git a/app/src/components/blocks/_lloydGeorge/lloydGeorgeViewRecordStage/LloydGeorgeViewRecordStage.test.tsx b/app/src/components/blocks/_lloydGeorge/lloydGeorgeViewRecordStage/LloydGeorgeViewRecordStage.test.tsx index 7b3edf11f..607f541db 100644 --- a/app/src/components/blocks/_lloydGeorge/lloydGeorgeViewRecordStage/LloydGeorgeViewRecordStage.test.tsx +++ b/app/src/components/blocks/_lloydGeorge/lloydGeorgeViewRecordStage/LloydGeorgeViewRecordStage.test.tsx @@ -9,7 +9,6 @@ import useRole from '../../../../helpers/hooks/useRole'; import useIsBSOL from '../../../../helpers/hooks/useIsBSOL'; import useConfig from '../../../../helpers/hooks/useConfig'; import { act, render, screen, waitFor } from '@testing-library/react'; -import formatFileSize from '../../../../helpers/utils/formatFileSize'; import { DOWNLOAD_STAGE } from '../../../../types/generic/downloadStage'; import { getFormattedDate } from '../../../../helpers/utils/formatDate'; import userEvent from '@testing-library/user-event'; @@ -62,11 +61,6 @@ describe('LloydGeorgeViewRecordStage', () => { expect(screen.getByText('View in full screen')).toBeInTheDocument(); expect(screen.getByText('Lloyd George record')).toBeInTheDocument(); expect(screen.getByText(`Last updated: ${mockPdf.lastUpdated}`)).toBeInTheDocument(); - expect(screen.getByText(`${mockPdf.numberOfFiles} files`)).toBeInTheDocument(); - expect( - screen.getByText(`File size: ${formatFileSize(mockPdf.totalFileSizeInBytes)}`), - ).toBeInTheDocument(); - expect(screen.getByText('File format: PDF')).toBeInTheDocument(); expect( screen.queryByText('No documents are available for this patient.'), diff --git a/app/src/components/blocks/_lloydGeorge/lloydGeorgeViewRecordStage/LloydGeorgeViewRecordStage.tsx b/app/src/components/blocks/_lloydGeorge/lloydGeorgeViewRecordStage/LloydGeorgeViewRecordStage.tsx index eec37f8ab..9d30b156d 100644 --- a/app/src/components/blocks/_lloydGeorge/lloydGeorgeViewRecordStage/LloydGeorgeViewRecordStage.tsx +++ b/app/src/components/blocks/_lloydGeorge/lloydGeorgeViewRecordStage/LloydGeorgeViewRecordStage.tsx @@ -97,8 +97,6 @@ function LloydGeorgeViewRecordStage({ const recordDetailsProps: RecordDetailsProps = { downloadStage, lastUpdated, - numberOfFiles, - totalFileSizeInBytes, }; const pageHeader = 'Available records'; @@ -258,17 +256,9 @@ function LloydGeorgeViewRecordStage({ ); } -type RecordDetailsProps = Pick< - Props, - 'downloadStage' | 'lastUpdated' | 'numberOfFiles' | 'totalFileSizeInBytes' ->; +type RecordDetailsProps = Pick; -const RecordDetails = ({ - downloadStage, - lastUpdated, - numberOfFiles, - totalFileSizeInBytes, -}: RecordDetailsProps) => { +const RecordDetails = ({ downloadStage, lastUpdated }: RecordDetailsProps) => { switch (downloadStage) { case DOWNLOAD_STAGE.INITIAL: case DOWNLOAD_STAGE.PENDING: @@ -277,8 +267,6 @@ const RecordDetails = ({ case DOWNLOAD_STAGE.SUCCEEDED: { const detailsProps = { lastUpdated, - numberOfFiles, - totalFileSizeInBytes, }; return ; } diff --git a/app/src/pages/lloydGeorgeRecordPage/LloydGeorgeRecordPage.test.tsx b/app/src/pages/lloydGeorgeRecordPage/LloydGeorgeRecordPage.test.tsx index 6fc97a136..0872260b1 100644 --- a/app/src/pages/lloydGeorgeRecordPage/LloydGeorgeRecordPage.test.tsx +++ b/app/src/pages/lloydGeorgeRecordPage/LloydGeorgeRecordPage.test.tsx @@ -7,7 +7,6 @@ import { } from '../../helpers/test/testBuilders'; import { getFormattedDate } from '../../helpers/utils/formatDate'; import axios from 'axios'; -import formatFileSize from '../../helpers/utils/formatFileSize'; import usePatient from '../../helpers/hooks/usePatient'; import useConfig from '../../helpers/hooks/useConfig'; import useRole from '../../helpers/hooks/useRole'; @@ -99,20 +98,6 @@ describe('LloydGeorgeRecordPage', () => { }); }); - it('calls refreshRecord and updates state when successful', async () => { - const lgResult = buildLgSearchResult(); - mockAxios.post.mockResolvedValue({ data: { jobStatus: 'Complete' } }); - mockAxios.get.mockResolvedValue({ data: lgResult }); - - renderPage(history); - - await waitFor(async () => { - expect(screen.getByText(`${lgResult.numberOfFiles} files`)).toBeInTheDocument(); - }); - - expect(screen.getByText('File format: PDF')).toBeInTheDocument(); - }); - it('renders initial lg record view with no docs available text if lambda return records status is uploading for more than 3 min', async () => { const errorResponse = { response: { @@ -199,12 +184,6 @@ describe('LloydGeorgeRecordPage', () => { expect(screen.getByText('Lloyd George record')).toBeInTheDocument(); expect(screen.queryByText('No documents are available')).not.toBeInTheDocument(); - - expect(screen.getByText(`${lgResult.numberOfFiles} files`)).toBeInTheDocument(); - expect( - screen.getByText(`File size: ${formatFileSize(lgResult.totalFileSizeInBytes)}`), - ).toBeInTheDocument(); - expect(screen.getByText('File format: PDF')).toBeInTheDocument(); }); describe('Accessibility', () => {