Skip to content

Commit 46821d5

Browse files
authored
[PRMP-1706] Remove references to is_BSOL/isBSOL (#587)
* [PRMP-1706] Remove all bsol logic
1 parent 411c784 commit 46821d5

28 files changed

+44
-408
lines changed

app/cypress/e2e/0-ndr-core-tests/auth_routes/auth_gp_admin_path_access.cy.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ const arfDownloadUrl = '/patient/arf';
2121

2222
const forbiddenRoutes = [arfDownloadUrl];
2323

24-
const bsolOptions = [true];
25-
2624
describe('GP Admin user role has access to the expected GP_ADMIN workflow paths', () => {
2725
context('GP Admin role has access to expected routes', () => {
2826
it('GP Admin role has access to Lloyd George View', { tags: 'regression' }, () => {

app/cypress/e2e/0-ndr-core-tests/gp_user_workflows/upload_lloyd_george_is_bsol_gp_admin.cy.js renamed to app/cypress/e2e/0-ndr-core-tests/gp_user_workflows/upload_lloyd_george_gp_admin.cy.js

File renamed without changes.

app/cypress/e2e/0-ndr-core-tests/gp_user_workflows/view_lloyd_george_is_bsol_workflow.cy.js renamed to app/cypress/e2e/0-ndr-core-tests/gp_user_workflows/view_lloyd_george_workflow.cy.js

File renamed without changes.
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{
22
"role": "GP_ADMIN",
3-
"authorisation_token": "111xxx222",
4-
"isBSOL": true
3+
"authorisation_token": "111xxx222"
54
}
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{
22
"role": "GP_CLINICAL",
3-
"authorisation_token": "111xxx222",
4-
"isBSOL": true
3+
"authorisation_token": "111xxx222"
54
}

app/src/components/blocks/_lloydGeorge/lloydGeorgeDownloadComplete/LloydGeorgeDownloadComplete.test.tsx

Lines changed: 6 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -35,48 +35,13 @@ describe('LloydGeorgeDownloadComplete', () => {
3535
jest.clearAllMocks();
3636
});
3737

38-
describe('LloydGeorgeDownloadComplete non BSOL journey', () => {
39-
it('renders the component', () => {
40-
render(
41-
<LloydGeorgeDownloadComplete
42-
deleteAfterDownload={true}
43-
numberOfFiles={numberOfFiles}
44-
setDownloadStage={mockSetDownloadStage}
45-
/>,
46-
);
47-
48-
expect(screen.getByRole('heading', { name: 'Download complete' })).toBeInTheDocument();
49-
expect(
50-
screen.getByText('You have successfully downloaded the Lloyd George record of:'),
51-
).toBeInTheDocument();
52-
expect(
53-
screen.getByText(mockPatient.givenName + ' ' + mockPatient.familyName),
54-
).toBeInTheDocument();
55-
expect(
56-
screen.getByText('This record has been removed from our storage.'),
57-
).toBeInTheDocument();
58-
expect(screen.getByText('Your responsibilities with this record')).toBeInTheDocument();
59-
expect(
60-
screen.getByText('Follow the Record Management Code of Practice'),
61-
).toBeInTheDocument();
62-
expect(
63-
screen.getByRole('button', {
64-
name: 'Return to patient record',
65-
}),
66-
).toBeInTheDocument();
67-
expect(screen.queryByText('Hide files')).not.toBeInTheDocument();
68-
});
69-
});
70-
71-
describe('LloydGeorgeDownloadComplete BSOL journeys', () => {
38+
describe('LloydGeorgeDownloadComplete journeys', () => {
7239
it('renders the download complete screen for download all journey', () => {
7340
render(
7441
<LgDownloadComplete
75-
deleteAfterDownload={false}
7642
numberOfFiles={downloadAllSelectedDocuments.length}
7743
selectedDocuments={downloadAllSelectedDocuments}
7844
searchResults={searchResults}
79-
setDownloadStage={mockSetDownloadStage}
8045
/>,
8146
);
8247

@@ -103,11 +68,9 @@ describe('LloydGeorgeDownloadComplete', () => {
10368
it('renders the download complete screen for download selected files journey', () => {
10469
render(
10570
<LgDownloadComplete
106-
deleteAfterDownload={false}
10771
numberOfFiles={selectedDocuments.length}
10872
selectedDocuments={selectedDocuments}
10973
searchResults={searchResults}
110-
setDownloadStage={mockSetDownloadStage}
11174
/>,
11275
);
11376

@@ -143,20 +106,10 @@ describe('LloydGeorgeDownloadComplete', () => {
143106
});
144107

145108
describe('Accessibility', () => {
146-
it.each([true, false])(
147-
'pass accessibility checks when deleteAfterDownload is %s',
148-
async (deleteAfterDownload) => {
149-
render(
150-
<LloydGeorgeDownloadComplete
151-
numberOfFiles={numberOfFiles}
152-
deleteAfterDownload={deleteAfterDownload}
153-
setDownloadStage={mockSetDownloadStage}
154-
/>,
155-
);
156-
157-
const results = await runAxeTest(document.body);
158-
expect(results).toHaveNoViolations();
159-
},
160-
);
109+
it('passes accessibility checks', async () => {
110+
render(<LloydGeorgeDownloadComplete numberOfFiles={numberOfFiles} />);
111+
const results = await runAxeTest(document.body);
112+
expect(results).toHaveNoViolations();
113+
});
161114
});
162115
});

app/src/components/blocks/_lloydGeorge/lloydGeorgeDownloadComplete/LloydGeorgeDownloadComplete.tsx

Lines changed: 2 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { Dispatch, SetStateAction } from 'react';
1+
import React from 'react';
22
import { Button, Card } from 'nhsuk-react-components';
33
import ReducedPatientInfo from '../../../generic/reducedPatientInfo/ReducedPatientInfo';
44
import useTitle from '../../../../helpers/hooks/useTitle';
@@ -7,33 +7,21 @@ import { routes } from '../../../../types/generic/routes';
77
import DocumentsListView from '../../../generic/documentsListView/DocumentsListView';
88
import { SearchResult } from '../../../../types/generic/searchResult';
99
import { GenericDocument } from '../../../../types/generic/genericDocument';
10-
import { DOWNLOAD_STAGE } from '../../../../types/generic/downloadStage';
1110

1211
export type Props = {
13-
deleteAfterDownload: boolean;
1412
numberOfFiles: number;
1513
selectedDocuments?: Array<string>;
1614
searchResults?: Array<SearchResult>;
17-
setDownloadStage: Dispatch<SetStateAction<DOWNLOAD_STAGE>>;
1815
};
1916

20-
function LloydGeorgeDownloadComplete({
21-
deleteAfterDownload,
22-
numberOfFiles,
23-
selectedDocuments,
24-
searchResults,
25-
setDownloadStage,
26-
}: Props) {
17+
function LloydGeorgeDownloadComplete({ numberOfFiles, selectedDocuments, searchResults }: Props) {
2718
const navigate = useNavigate();
2819

2920
const selectedFilesDownload = !!selectedDocuments?.length;
3021
const pageHeader = 'Download complete';
3122
useTitle({ pageTitle: pageHeader });
3223

3324
const handleReturnButtonClick = () => {
34-
if (deleteAfterDownload) {
35-
setDownloadStage(DOWNLOAD_STAGE.REFRESH);
36-
}
3725
navigate(routes.LLOYD_GEORGE);
3826
};
3927

@@ -102,34 +90,6 @@ function LloydGeorgeDownloadComplete({
10290
/>
10391
</>
10492
)}
105-
{deleteAfterDownload && (
106-
<>
107-
<p>This record has been removed from our storage.</p>
108-
<p className="lloydgeorge_download-complete_paragraph-headers">
109-
Keep this patient's record safe
110-
</p>
111-
<ol>
112-
<li>
113-
Store the record in an accessible and recoverable format within a secure
114-
network folder
115-
</li>
116-
<li>
117-
Ensure all access to the record is auditable, so information can be
118-
provided about who accessed the record
119-
</li>
120-
<li>
121-
If the patient moves practice, you must make sure the patient record
122-
safely transfers to their new practice
123-
</li>
124-
<li>
125-
Follow data protection principles outlined in{' '}
126-
<a href="https://ico.org.uk/for-organisations/uk-gdpr-guidance-and-resources/data-protection-principles/a-guide-to-the-data-protection-principles/">
127-
UK General Data Protection Regulation (UK GDPR)
128-
</a>
129-
</li>
130-
</ol>
131-
</>
132-
)}
13393
<h2 className="nhsuk-heading-l">Your responsibilities with this record</h2>
13494
<p>
13595
Everyone in a health and care organisation is responsible for managing records

app/src/components/blocks/_lloydGeorge/lloydGeorgeDownloadStage/LloydGeorgeDownloadStage.test.tsx

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -133,40 +133,6 @@ describe('LloydGeorgeDownloadStage', () => {
133133
expect(results).toHaveNoViolations();
134134
});
135135

136-
it('navigates to Error page when zip lg record view complete but fail on delete', async () => {
137-
window.HTMLAnchorElement.prototype.click = jest.fn();
138-
mockGetPresignedUrlForZip.mockResolvedValue(mockPdf.presignedUrl);
139-
const errorResponse = {
140-
response: {
141-
status: 500,
142-
data: { message: 'An error occurred', err_code: 'SP_1001' },
143-
},
144-
};
145-
mockedAxios.delete.mockImplementation(() => Promise.reject(errorResponse));
146-
147-
jest.useFakeTimers();
148-
149-
renderComponent(history, { deleteAfterDownload: true });
150-
151-
expect(screen.getByText('0% downloaded...')).toBeInTheDocument();
152-
expect(screen.queryByText('100% downloaded...')).not.toBeInTheDocument();
153-
154-
act(() => {
155-
jest.advanceTimersByTime(500);
156-
});
157-
158-
await waitFor(() => {
159-
expect(screen.getByText('100% downloaded...')).toBeInTheDocument();
160-
});
161-
expect(screen.queryByText('0% downloaded...')).not.toBeInTheDocument();
162-
163-
await waitFor(() => {
164-
expect(mockedUseNavigate).toHaveBeenCalledWith(
165-
routes.SERVER_ERROR + '?encodedError=WyJTUF8xMDAxIiwiMTU3NzgzNjgwMCJd',
166-
);
167-
});
168-
});
169-
170136
it('navigates to Error page when zip lg record view return 500', async () => {
171137
const errorResponse = {
172138
response: {
@@ -223,7 +189,6 @@ describe('LloydGeorgeDownloadStage', () => {
223189

224190
const renderComponent = (history: MemoryHistory, propsOverride?: Partial<Props>) => {
225191
const props: Omit<Props, 'setStage' | 'setDownloadStage'> = {
226-
deleteAfterDownload: false,
227192
...propsOverride,
228193
numberOfFiles: mockPdf.numberOfFiles,
229194
};

app/src/components/blocks/_lloydGeorge/lloydGeorgeDownloadStage/LloydGeorgeDownloadStage.tsx

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import getPresignedUrlForZip from '../../../../helpers/requests/getPresignedUrlF
55
import { DOCUMENT_TYPE } from '../../../../types/pages/UploadDocumentsPage/types';
66
import useBaseAPIUrl from '../../../../helpers/hooks/useBaseAPIUrl';
77
import usePatient from '../../../../helpers/hooks/usePatient';
8-
import deleteAllDocuments from '../../../../helpers/requests/deleteAllDocuments';
98
import { routeChildren, routes } from '../../../../types/generic/routes';
109
import { useNavigate, Link } from 'react-router-dom';
1110
import { errorToParams } from '../../../../helpers/utils/errorToParams';
@@ -17,7 +16,6 @@ import useTitle from '../../../../helpers/hooks/useTitle';
1716
const FakeProgress = require('fake-progress');
1817

1918
export type Props = {
20-
deleteAfterDownload: boolean;
2119
selectedDocuments?: Array<string>;
2220
numberOfFiles: number;
2321
};
@@ -27,11 +25,7 @@ type DownloadLinkAttributes = {
2725
filename: string;
2826
};
2927

30-
function LloydGeorgeDownloadStage({
31-
deleteAfterDownload = false,
32-
selectedDocuments,
33-
numberOfFiles,
34-
}: Props) {
28+
function LloydGeorgeDownloadStage({ selectedDocuments, numberOfFiles }: Props) {
3529
const timeToComplete = 600;
3630
const [progress, setProgress] = useState(0);
3731
const baseUrl = useBaseAPIUrl();
@@ -109,19 +103,6 @@ function LloydGeorgeDownloadStage({
109103
});
110104

111105
const filename = `patient-record-${nhsNumber}`;
112-
if (deleteAfterDownload) {
113-
try {
114-
await deleteAllDocuments({
115-
docType: DOCUMENT_TYPE.LLOYD_GEORGE,
116-
nhsNumber: nhsNumber,
117-
baseUrl,
118-
baseHeaders,
119-
});
120-
} catch (e) {
121-
const error = e as AxiosError;
122-
onFail(error);
123-
} // This is fail and forget at this point in time.
124-
}
125106
setLinkAttributes({ url: preSignedUrl, filename: filename });
126107
} catch (e) {
127108
const error = e as AxiosError;
@@ -143,7 +124,6 @@ function LloydGeorgeDownloadStage({
143124
intervalTimer,
144125
nhsNumber,
145126
progressTimer,
146-
deleteAfterDownload,
147127
navigate,
148128
mockLocal,
149129
selectedDocuments,

app/src/components/blocks/_lloydGeorge/lloydGeorgeRecordError/LloydGeorgeRecordError.test.tsx

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,10 @@ import { LinkProps } from 'react-router-dom';
55
import useRole from '../../../../helpers/hooks/useRole';
66
import { REPOSITORY_ROLE } from '../../../../types/generic/authRole';
77
import { routeChildren, routes } from '../../../../types/generic/routes';
8-
import useIsBSOL from '../../../../helpers/hooks/useIsBSOL';
98
import useConfig from '../../../../helpers/hooks/useConfig';
109
import { buildConfig } from '../../../../helpers/test/testBuilders';
1110
import { runAxeTest } from '../../../../helpers/test/axeTestHelper';
1211

13-
jest.mock('../../../../helpers/hooks/useIsBSOL');
1412
jest.mock('../../../../helpers/hooks/useRole');
1513
jest.mock('../../../../helpers/hooks/useConfig');
1614
jest.mock('react-router-dom', () => ({
@@ -19,7 +17,6 @@ jest.mock('react-router-dom', () => ({
1917
}));
2018

2119
const mockUseRole = useRole as jest.Mock;
22-
const mockIsBSOL = useIsBSOL as jest.Mock;
2320
const mockUseConfig = useConfig as jest.Mock;
2421
const mockNavigate = jest.fn();
2522

@@ -57,21 +54,6 @@ describe('LloydGeorgeRecordError', () => {
5754
).toBeInTheDocument();
5855
});
5956

60-
it("renders a message when the document download status is 'No records' and user is non BSOL", () => {
61-
const timeoutStatus = DOWNLOAD_STAGE.NO_RECORDS;
62-
mockIsBSOL.mockReturnValue(false);
63-
64-
render(<LloydGeorgeRecordError downloadStage={timeoutStatus} />);
65-
66-
expect(
67-
screen.getByText(
68-
/This patient does not have a Lloyd George record stored in this service/i,
69-
),
70-
).toBeInTheDocument();
71-
expect(
72-
screen.queryByRole('button', { name: 'Upload patient record' }),
73-
).not.toBeInTheDocument();
74-
});
7557
it("renders a message when the document download status is 'Uploading'", () => {
7658
const timeoutStatus = DOWNLOAD_STAGE.UPLOADING;
7759

@@ -87,9 +69,8 @@ describe('LloydGeorgeRecordError', () => {
8769
).not.toBeInTheDocument();
8870
});
8971

90-
it("renders a message and upload button when the document download status is 'No records', user is admin BSOL and upload flags are enabled", () => {
72+
it("renders a message and upload button when the document download status is 'No records', user is admin and upload flags are enabled", () => {
9173
const noRecordsStatus = DOWNLOAD_STAGE.NO_RECORDS;
92-
mockIsBSOL.mockReturnValue(true);
9374
mockUseRole.mockReturnValue(REPOSITORY_ROLE.GP_ADMIN);
9475
mockUseConfig.mockReturnValue(
9576
buildConfig(
@@ -109,10 +90,9 @@ describe('LloydGeorgeRecordError', () => {
10990
).toBeInTheDocument();
11091
});
11192

112-
it("renders a message but no upload button when the document download status is 'No records', user is admin BSOL and upload flags are not enabled", () => {
93+
it("renders a message but no upload button when the document download status is 'No records', user is admin and upload flags are not enabled", () => {
11394
const noRecordsStatus = DOWNLOAD_STAGE.NO_RECORDS;
11495

115-
mockIsBSOL.mockReturnValue(true);
11696
mockUseRole.mockReturnValue(REPOSITORY_ROLE.GP_ADMIN);
11797

11898
render(<LloydGeorgeRecordError downloadStage={noRecordsStatus} />);
@@ -143,8 +123,7 @@ describe('LloydGeorgeRecordError', () => {
143123
expect(results).toHaveNoViolations();
144124
});
145125

146-
it('pass accessibility checks for DOWNLOAD_STAGE.NO_RECORDS when user is GP_ADMIN in BSOL', async () => {
147-
mockIsBSOL.mockReturnValue(true);
126+
it('pass accessibility checks for DOWNLOAD_STAGE.NO_RECORDS when user is GP_ADMIN', async () => {
148127
mockUseRole.mockReturnValue(REPOSITORY_ROLE.GP_ADMIN);
149128
mockUseConfig.mockReturnValue(
150129
buildConfig(
@@ -237,9 +216,8 @@ describe('LloydGeorgeRecordError', () => {
237216
expect(mockNavigate).toBeCalledWith(routes.UNAUTHORISED);
238217
});
239218

240-
it("navigates to upload page, when the document download status is 'No records', user is admin BSOL and upload flags are enabled", () => {
219+
it("navigates to upload page, when the document download status is 'No records', user is admin and upload flags are enabled", () => {
241220
const noRecordsStatus = DOWNLOAD_STAGE.NO_RECORDS;
242-
mockIsBSOL.mockReturnValue(true);
243221
mockUseRole.mockReturnValue(REPOSITORY_ROLE.GP_ADMIN);
244222
mockUseConfig.mockReturnValue(
245223
buildConfig(

0 commit comments

Comments
 (0)