Skip to content

Commit

Permalink
Merge branch 'main' into 121-update-libraries-batch-2
Browse files Browse the repository at this point in the history
  • Loading branch information
stanislaw-zakrzewski committed Apr 23, 2024
2 parents dc59615 + b950a17 commit 1ea9578
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 7 deletions.
1 change: 1 addition & 0 deletions dev/docker-compose.dev.full.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions dev/docker-compose.dev.full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
VITE_APP_RECAPTCHA_SITE_KEY: "${VITE_APP_RECAPTCHA_SITE_KEY}"
VITE_APP_DATA_DICTIONARY_LINK: "${VITE_APP_DATA_DICTIONARY_LINK}"
ENABLE_LOCAL_AUTH: "true"
DISEASE_NAME: "${DISEASE_NAME}"
localstack:
Expand Down
1 change: 1 addition & 0 deletions dev/docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,4 @@ services:
VITE_APP_COOKIE_CONSENT_PUBLIC_ID: "${REACT_APP_COOKIE_CONSENT_PUBLIC_ID}"
VITE_APP_RECAPTCHA_SITE_KEY: "${VITE_APP_RECAPTCHA_SITE_KEY}"
VITE_APP_DISEASE_NAME: "${REACT_APP_DISEASE_NAME}"
VITE_APP_DATA_DICTIONARY_LINK: "${VITE_APP_DATA_DICTIONARY_LINK}"
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import { MapLink } from '../../constants/types';
import validateEnv from '../../util/validate-env';
import { Role } from '../../api/models/User';

const mockedDataDictionaryLink = 'https://global.health/data-dictionary';

const env = validateEnv();

beforeAll(() => {
Expand All @@ -22,6 +24,10 @@ beforeEach(() => {
vi.clearAllMocks();
});

beforeAll(() => {
process.env.VITE_APP_DATA_DICTIONARY_LINK = mockedDataDictionaryLink;
});

describe('<App />', () => {
it('renders without crashing when logged in', async () => {
const axiosResponse = {
Expand Down Expand Up @@ -136,7 +142,7 @@ describe('<App />', () => {
);
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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ function ProfileMenu(props: { user: User; version: string }): JSX.Element {
<a
rel="noopener noreferrer"
target="_blank"
href="https://raw.githubusercontent.com/globaldothealth/list/main/data-serving/scripts/export-data/data_dictionary.txt"
href={process.env.REACT_APP_DATA_DICTIONARY_LINK}
onClick={handleClose}
className={classes.link}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ export function DownloadButton(): JSX.Element {

<Typography variant="body2">
<a
href="https://raw.githubusercontent.com/globaldothealth/list/main/data-serving/scripts/export-data/data_dictionary.txt"
href={process.env.REACT_APP_DATA_DICTIONARY_LINK}
target="_blank"
rel="noreferrer"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const Footer = ({ drawerOpen }: FooterProps): JSX.Element => {

<section>
<a
href="https://raw.githubusercontent.com/globaldothealth/list/main/data-serving/scripts/export-data/data_dictionary.txt"
href={process.env.REACT_APP_DATA_DICTIONARY_LINK}
rel="noopener noreferrer"
target="_blank"
data-testid="dictionaryButton"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());

Expand Down Expand Up @@ -63,7 +67,7 @@ describe('<LandingPage />', () => {
);
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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ const MoreInformationLinks = ({
</div>
<div className={classes.link}>
<a
href="https://raw.githubusercontent.com/globaldothealth/list/main/data-serving/scripts/export-data/data_dictionary.txt"
href={process.env.REACT_APP_DATA_DICTIONARY_LINK}
rel="noopener noreferrer"
target="_blank"
>
Expand Down

0 comments on commit 1ea9578

Please sign in to comment.