diff --git a/app/src/pages/adminPage/AdminPage.test.tsx b/app/src/pages/adminPage/AdminPage.test.tsx
index 806d57104..9956484ea 100644
--- a/app/src/pages/adminPage/AdminPage.test.tsx
+++ b/app/src/pages/adminPage/AdminPage.test.tsx
@@ -37,6 +37,28 @@ describe('AdminPage', (): void => {
),
).toBeInTheDocument();
});
+
+ it('renders the Download a report card', (): void => {
+ render();
+ const reportLink = screen.getByTestId('download-report-btn');
+ expect(reportLink).toBeInTheDocument();
+ expect(reportLink).toHaveTextContent('Download a report');
+ });
+
+ it('renders the Download a report card with correct href', (): void => {
+ render();
+ const reportLink = screen.getByTestId('download-report-btn');
+ expect(reportLink).toHaveAttribute('href', '/create-report?reportType=0');
+ });
+
+ it('renders the Download a report card description', (): void => {
+ render();
+ expect(
+ screen.getByText(
+ 'This report shows the list of Lloyd George records stored for your organisation.',
+ ),
+ ).toBeInTheDocument();
+ });
});
describe('Accessibility', (): void => {
diff --git a/app/src/pages/adminPage/AdminPage.tsx b/app/src/pages/adminPage/AdminPage.tsx
index 137e1291c..8e441e41c 100644
--- a/app/src/pages/adminPage/AdminPage.tsx
+++ b/app/src/pages/adminPage/AdminPage.tsx
@@ -2,7 +2,8 @@ import { Card } from 'nhsuk-react-components';
import { JSX } from 'react';
import useTitle from '../../helpers/hooks/useTitle';
import { ReactComponent as RightCircleIcon } from '../../styles/right-chevron-circle.svg';
-import { routeChildren } from '../../types/generic/routes';
+import { routeChildren, routes } from '../../types/generic/routes';
+import {REPORT_TYPE} from "../../types/generic/reports";
export const AdminPage = (): JSX.Element => {
useTitle({ pageTitle: 'Admin hub' });
@@ -30,6 +31,25 @@ export const AdminPage = (): JSX.Element => {
+
+
+
+
+
+ Download a report
+
+
+
+ This report shows the list of Lloyd George records stored for
+ your organisation.
+
+
+
+
+
>
);
diff --git a/app/src/pages/homePage/HomePage.test.tsx b/app/src/pages/homePage/HomePage.test.tsx
index 871464f73..90e06edae 100644
--- a/app/src/pages/homePage/HomePage.test.tsx
+++ b/app/src/pages/homePage/HomePage.test.tsx
@@ -29,9 +29,11 @@ describe('HomePage', () => {
});
describe('Rendering', () => {
- it('should render home page with patient search and download report', async () => {
+ it('should render home page with patient search and download report when uploadDocumentIteration3Enabled is false', async () => {
+ mockUseConfig.mockReturnValue(
+ buildConfig(undefined, { uploadDocumentIteration3Enabled: false }),
+ );
render();
-
const searchPatientButton = screen.getByTestId(
'search-patient-btn',
) as HTMLAnchorElement;
@@ -40,46 +42,23 @@ describe('HomePage', () => {
) as HTMLAnchorElement;
expect(searchPatientButton).toBeInTheDocument();
expect(downloadReportButton).toBeInTheDocument();
- });
- });
-
- describe('Admin Console button', () => {
- it('renders admin console button when feature flag is enabled', () => {
- mockUseConfig.mockReturnValue(
- buildConfig(undefined, { uploadDocumentIteration3Enabled: true }),
- );
-
- render();
-
- const adminConsoleButton = screen.getByTestId('admin-console-btn') as HTMLAnchorElement;
- expect(adminConsoleButton).toBeInTheDocument();
- expect(adminConsoleButton).toHaveTextContent('Admin console');
- expect(adminConsoleButton).toHaveAttribute('href', routes.ADMIN_ROUTE);
- });
-
- it('does not render admin console button when feature flag is disabled', () => {
- mockUseConfig.mockReturnValue(
- buildConfig(undefined, { uploadDocumentIteration3Enabled: false }),
- );
-
- render();
-
expect(screen.queryByTestId('admin-console-btn')).not.toBeInTheDocument();
});
- });
- describe('Admin Console button', () => {
- it('renders admin console button when feature flag is enabled and user is GP_ADMIN', () => {
+ it('should render home page with patient search and admin console when uploadDocumentIteration3Enabled is true', async () => {
mockUseConfig.mockReturnValue(
buildConfig(undefined, { uploadDocumentIteration3Enabled: true }),
);
-
render();
-
+ const searchPatientButton = screen.getByTestId(
+ 'search-patient-btn',
+ ) as HTMLAnchorElement;
const adminConsoleButton = screen.getByTestId('admin-console-btn') as HTMLAnchorElement;
+ expect(searchPatientButton).toBeInTheDocument();
expect(adminConsoleButton).toBeInTheDocument();
expect(adminConsoleButton).toHaveTextContent('Admin console');
expect(adminConsoleButton).toHaveAttribute('href', routes.ADMIN_ROUTE);
+ expect(screen.queryByTestId('download-report-btn')).not.toBeInTheDocument();
});
it('does not render admin console button when feature flag is disabled', () => {
diff --git a/app/src/pages/homePage/HomePage.tsx b/app/src/pages/homePage/HomePage.tsx
index 7790f44c1..7585575bd 100644
--- a/app/src/pages/homePage/HomePage.tsx
+++ b/app/src/pages/homePage/HomePage.tsx
@@ -55,7 +55,7 @@ const HomePage = (): React.JSX.Element => {
- {config.featureFlags.uploadDocumentIteration3Enabled && (
+ {config.featureFlags.uploadDocumentIteration3Enabled ? (
@@ -74,26 +74,27 @@ const HomePage = (): React.JSX.Element => {
+ ) : (
+
+
+
+
+
+ Download a report
+
+
+
+ This report shows the list of Lloyd George records stored for
+ your organisation.
+
+
+
+
+
)}
-
-
-
-
-
- Download a report
-
-
-
- This report shows the list of Lloyd George records stored for your
- organisation.
-
-
-
-
-
>
);