From 18926b02628bf0a2687b217f5ab934734488c748 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stanis=C5=82aw=20Zakrzewski?= Date: Thu, 4 Apr 2024 14:13:25 +0200 Subject: [PATCH 1/2] Use env variable for setting the data dictionary link --- dev/docker-compose.dev.full.test.yml | 1 + dev/docker-compose.dev.full.yml | 1 + dev/docker-compose.dev.yml | 1 + verification/curator-service/ui/src/components/App/index.tsx | 2 +- .../curator-service/ui/src/components/DownloadButton/index.tsx | 2 +- verification/curator-service/ui/src/components/Footer/index.tsx | 2 +- .../ui/src/components/landing-page/LandingPage.tsx | 2 +- 7 files changed, 7 insertions(+), 4 deletions(-) diff --git a/dev/docker-compose.dev.full.test.yml b/dev/docker-compose.dev.full.test.yml index 4c8ee0f89..1b9920bde 100644 --- a/dev/docker-compose.dev.full.test.yml +++ b/dev/docker-compose.dev.full.test.yml @@ -45,6 +45,7 @@ services: REACT_APP_PUBLIC_MAPBOX_TOKEN: "${REACT_APP_PUBLIC_MAPBOX_TOKEN}" REACT_APP_POLICY_PUBLIC_ID: "${REACT_APP_POLICY_PUBLIC_ID}" REACT_APP_COOKIE_CONSENT_PUBLIC_ID: "${REACT_APP_COOKIE_CONSENT_PUBLIC_ID}" + REACT_APP_DATA_DICTIONARY_LINK: "${REACT_APP_DATA_DICTIONARY_LINK}" ENABLE_LOCAL_AUTH: "true" localstack: image: localstack/localstack-pro diff --git a/dev/docker-compose.dev.full.yml b/dev/docker-compose.dev.full.yml index fa669b6ce..5073375c5 100644 --- a/dev/docker-compose.dev.full.yml +++ b/dev/docker-compose.dev.full.yml @@ -51,6 +51,7 @@ services: REACT_APP_POLICY_PUBLIC_ID: "${REACT_APP_POLICY_PUBLIC_ID}" REACT_APP_COOKIE_CONSENT_PUBLIC_ID: "${REACT_APP_COOKIE_CONSENT_PUBLIC_ID}" REACT_APP_RECAPTCHA_SITE_KEY: "${REACT_APP_RECAPTCHA_SITE_KEY}" + REACT_APP_DATA_DICTIONARY_LINK: "${REACT_APP_DATA_DICTIONARY_LINK}" ENABLE_LOCAL_AUTH: "true" DISEASE_NAME: "${DISEASE_NAME}" localstack: diff --git a/dev/docker-compose.dev.yml b/dev/docker-compose.dev.yml index f1333e533..480f31d21 100644 --- a/dev/docker-compose.dev.yml +++ b/dev/docker-compose.dev.yml @@ -36,3 +36,4 @@ services: REACT_APP_COOKIE_CONSENT_PUBLIC_ID: "${REACT_APP_COOKIE_CONSENT_PUBLIC_ID}" REACT_APP_RECAPTCHA_SITE_KEY: "${REACT_APP_RECAPTCHA_SITE_KEY}" REACT_APP_DISEASE_NAME: "${REACT_APP_DISEASE_NAME}" + REACT_APP_DATA_DICTIONARY_LINK: "${REACT_APP_DATA_DICTIONARY_LINK}" diff --git a/verification/curator-service/ui/src/components/App/index.tsx b/verification/curator-service/ui/src/components/App/index.tsx index d22c12a74..9bb53f7b1 100644 --- a/verification/curator-service/ui/src/components/App/index.tsx +++ b/verification/curator-service/ui/src/components/App/index.tsx @@ -222,7 +222,7 @@ function ProfileMenu(props: { user: User; version: string }): JSX.Element { diff --git a/verification/curator-service/ui/src/components/DownloadButton/index.tsx b/verification/curator-service/ui/src/components/DownloadButton/index.tsx index 774140b4f..cea615b64 100644 --- a/verification/curator-service/ui/src/components/DownloadButton/index.tsx +++ b/verification/curator-service/ui/src/components/DownloadButton/index.tsx @@ -247,7 +247,7 @@ export function DownloadButton(): JSX.Element { diff --git a/verification/curator-service/ui/src/components/Footer/index.tsx b/verification/curator-service/ui/src/components/Footer/index.tsx index c222268b0..de07fd2f9 100644 --- a/verification/curator-service/ui/src/components/Footer/index.tsx +++ b/verification/curator-service/ui/src/components/Footer/index.tsx @@ -62,7 +62,7 @@ const Footer = ({ drawerOpen }: FooterProps): JSX.Element => {
From ef9b67b1b1d9a931600b8cd4b656094cd8ec2a29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stanis=C5=82aw=20Zakrzewski?= Date: Thu, 4 Apr 2024 14:30:57 +0200 Subject: [PATCH 2/2] Update tests --- .../curator-service/ui/src/components/App/App.test.tsx | 7 ++++++- .../ui/src/components/landing-page/LandingPage.test.tsx | 8 ++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/verification/curator-service/ui/src/components/App/App.test.tsx b/verification/curator-service/ui/src/components/App/App.test.tsx index 4c0f378de..785c03246 100644 --- a/verification/curator-service/ui/src/components/App/App.test.tsx +++ b/verification/curator-service/ui/src/components/App/App.test.tsx @@ -9,12 +9,17 @@ import { Role } from '../../api/models/User'; jest.mock('axios'); const mockedAxios = axios as jest.Mocked; +const mockedDataDictionaryLink = 'https://global.health/data-dictionary'; const env = validateEnv(); beforeEach(() => { jest.clearAllMocks(); }); +beforeAll(() => { + process.env.REACT_APP_DATA_DICTIONARY_LINK = mockedDataDictionaryLink; +}); + describe('', () => { it('renders without crashing when logged in', async () => { const axiosResponse = { @@ -129,7 +134,7 @@ describe('', () => { ); expect(await screen.findByTestId('dictionaryButton')).toHaveAttribute( 'href', - 'https://raw.githubusercontent.com/globaldothealth/list/main/data-serving/scripts/export-data/data_dictionary.txt', + mockedDataDictionaryLink, ); expect(await screen.findByTestId('termsButton')).toHaveAttribute( 'href', diff --git a/verification/curator-service/ui/src/components/landing-page/LandingPage.test.tsx b/verification/curator-service/ui/src/components/landing-page/LandingPage.test.tsx index e26f29946..bf08276a7 100644 --- a/verification/curator-service/ui/src/components/landing-page/LandingPage.test.tsx +++ b/verification/curator-service/ui/src/components/landing-page/LandingPage.test.tsx @@ -8,8 +8,12 @@ import { setupServer } from 'msw/node'; import { Route } from 'react-router-dom'; const server = setupServer(); +const mockedDataDictionaryLink = 'https://global.health/data-dictionary'; -beforeAll(() => server.listen()); +beforeAll(() => { + server.listen(); + process.env.REACT_APP_DATA_DICTIONARY_LINK = mockedDataDictionaryLink; +}); afterEach(() => server.resetHandlers()); afterAll(() => server.close()); @@ -62,7 +66,7 @@ describe('', () => { ); expect(screen.getByText('Data dictionary')).toHaveAttribute( 'href', - 'https://raw.githubusercontent.com/globaldothealth/list/main/data-serving/scripts/export-data/data_dictionary.txt', + mockedDataDictionaryLink, ); expect(screen.getByText('Terms of use')).toHaveAttribute( 'href',