Skip to content

Commit

Permalink
Merge branch 'develop' into fixup/github-actions-rename
Browse files Browse the repository at this point in the history
  • Loading branch information
ivan-c authored Dec 30, 2024
2 parents bc17c15 + dfbd7c5 commit 6b12fbc
Show file tree
Hide file tree
Showing 132 changed files with 41,572 additions and 3,172 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ PORT=8000
REACT_APP_EPIC_SUPPORTED_QUERIES=false
GENERATE_SOURCEMAP=false

#REACT_APP_SYSTEM_TYPE=
2 changes: 1 addition & 1 deletion .github/workflows/docker-cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ jobs:

# create docker image tags to match git tags
tag_names: true
buildargs: VERSION_STRING
buildargs: REACT_APP_VERSION_STRING
21 changes: 21 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# run test suite
---
name: Test
on: [push]
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@master

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 10.x

- name: Install dependencies
run: yarn install

- name: Run tests
run: yarn test
2 changes: 2 additions & 0 deletions default.env
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ USE_DEMO=false

#url for patient search
REACT_APP_DASHBOARD_URL:http://localtest.me:5000


5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.3.2",
"@testing-library/user-event": "^7.1.2",
"commonmark": "^0.30.0",
"core-js": "^3.6.5",
"cql-exec-fhir": "^1.3.1",
"cql-execution": "^1.3.7",
Expand All @@ -23,6 +24,8 @@
"d3-time-format": "^2.2.3",
"d3-transition": "^1.3.2",
"fhirclient": "^2.3.0",
"file-saver": "^2.0.5",
"html-to-image": "^1.11.11",
"moment": "^2.24.0",
"node-sass": "^4.13.1",
"react": "^16.12.0",
Expand All @@ -34,7 +37,7 @@
"react-scripts": "^3.4.0",
"react-table": "^6.11.4",
"react-tooltip": "^3.11.6",
"tocbot": "^4.10.0"
"tocbot": "^4.25.0"
},
"devDependencies": {
"@rescripts/cli": "^0.0.13",
Expand Down
27 changes: 27 additions & 0 deletions public/assets/data/patientEducationReferences.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,33 @@
"size": "487 KB"
}
},
{
"link": {
"title": "Naloxone Information Sheet",
"className": "education",
"url": "{process.env.PUBLIC_URL}/assets/files/NaloxoneInformationSheet.pdf",
"type": "PDF",
"size": "142 KB"
}
},
{
"link": {
"title": "Naloxone Instruction (English)",
"className": "education",
"url": "https://20797746.fs1.hubspotusercontent-na1.net/hubfs/20797746/Narcan%20Nasal%20Spray%204%20mg%20OTC%20Quick%20Start%20Guide.pdf",
"type": "PDF",
"size": "142 KB"
}
},
{
"link": {
"title": "Naloxone Instruction (Spanish)",
"className": "education",
"url": "https://narcan.com/hubfs/2024-Website-Assets/Spanish%20Files/NARCAN%20Instructions%20for%20Use.pdf?hsLang=en",
"type": "PDF",
"size": "674 KB"
}
},
{
"link": {
"title": "Naloxone Patient / Public",
Expand Down
Binary file added public/assets/files/NaloxoneInformationSheet.pdf
Binary file not shown.
Binary file added public/assets/images/alertExclamation.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
791 changes: 791 additions & 0 deletions public/assets/images/body_diagram_horizontal.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/images/failDownArrow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/images/failUpArrow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/images/line.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/images/passDownArrow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/images/passUpArrow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/images/warningExclamation.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 10 additions & 9 deletions public/index.html
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta charset="utf-8" />
<!-- Use Internet Explorer Edge Standards mode -->
<meta http-equiv="x-ua-compatible" content="IE=edge" >
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="theme-color" content="#000000">
<link rel="manifest" href="%PUBLIC_URL%/manifest.json">
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
<meta http-equiv="x-ua-compatible" content="IE=edge" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no"
/>
<meta name="theme-color" content="#000000" />
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico" />
<title>Washington Opioid Clinical Assessment</title>
</head>
<body>
<noscript>
You need to enable JavaScript to run this app.
</noscript>
<noscript> You need to enable JavaScript to run this app. </noscript>
<div id="root"></div>
</body>
</html>
1 change: 1 addition & 0 deletions public/launch-context.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
"scope": "patient/*.read launch/patient",
"completeInTarget": true
}

4 changes: 2 additions & 2 deletions src/__tests__/components/ExclusionBanner.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ it('renders without crashing', () => {
});

it('closes the banner when the button is clicked', () => {
expect(component.find('.exclusion-banner').hasClass('close')).toBe(false);
component.simulate('click');
expect(component.find('.exclusion-banner').hasClass('close')).toBe(true);
component.simulate('click');
expect(component.find('.exclusion-banner').hasClass('close')).toBe(false);
});
20 changes: 20 additions & 0 deletions src/__tests__/components/Landing.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,25 @@ import { shallowRender } from '../../utils/testHelpers';
import Landing from '../../components/Landing';

let spy;

Promise.allSettled = function (promises) {
let mappedPromises = promises.map((p) => {
return p
.then((value) => {
return {
status: 'fulfilled',
value,
};
})
.catch((reason) => {
return {
status: 'rejected',
reason,
};
});
});
return Promise.all(mappedPromises);
};
beforeAll(() => {
// This test logs an ugly error because FHIR is not initialized (as expected).
// Since we expect this error, we suppress console.error here
Expand All @@ -13,3 +32,4 @@ it('renders without crashing', () => {
const component = shallowRender(Landing, {});
expect(component).toExist();
});

23 changes: 23 additions & 0 deletions src/__tests__/components/Report.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { shallowRender } from "../../utils/testHelpers";
import Report from "../../components/Report";
import { mockSurveySummaryData } from "../../utils/testFixtures";

let spy;
beforeAll(() => {
// This test logs an ugly error because FHIR is not initialized (as expected).
// Since we expect this error, we suppress console.error here
spy = jest.spyOn(global.console, "error").mockImplementation(() => jest.fn());
});
afterAll(() => spy.mockRestore());

it("renders without summary data without crashing", () => {
const component = shallowRender(Report);
expect(component).toExist();
});

it("renders with summary data without crashing", () => {
const component = shallowRender(Report, {
summary: mockSurveySummaryData
});
expect(component).toExist();
});
25 changes: 25 additions & 0 deletions src/__tests__/components/Report/Score.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { shallowRender } from "../../../utils/testHelpers";
import Score from "../../../components/Report/components/Score";

it("renders the score with high severity", () => {
const component = shallowRender(Score, {
score: 1,
scoreParams: {
scoreSeverity: "high",
},
});
expect(component.find(".text-alert")).toExist();
});

it("renders the score without severity", () => {
const component = shallowRender(Score, {
score: 1
});
expect(component.find(".text-alert")).toHaveLength(0);
});

it("renders without params without crashing", () => {
const component = shallowRender(Score);
expect(component).toExist();
});

42 changes: 42 additions & 0 deletions src/__tests__/components/Report/ScoringSummary.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { shallowRender } from "../../../utils/testHelpers";
import { mockSurveySummaryData } from "../../../utils/testFixtures";
import { mockSurveySummaryNoData } from "../../../utils/testFixtures";
import ScoringSummary from "../../../components/Report/components/ScoringSummary";

const component = shallowRender(ScoringSummary, {
summary: mockSurveySummaryData,
});

it("renders without crashing", () => {
expect(component).toExist();
});

it("renders the header with data", () => {
expect(component.find(".table th")).toExist();
});

it("renders the body with data", () => {
expect(component.find(".table .data-row")).toExist();
});

it("renders component without data without crashing", () => {
const noDataComponent = shallowRender(ScoringSummary);
expect(noDataComponent).toExist();
});

it("renders component without data - no header", () => {
const noDataComponent = shallowRender(ScoringSummary);
expect(noDataComponent.find(".table .no-data-row")).toExist();
});

it("renders component without data - no data row", () => {
const noDataComponent = shallowRender(ScoringSummary);
expect(noDataComponent.find(".table th")).toHaveLength(0);
});

it("renders component without responses", () => {
const noDataComponent = shallowRender(ScoringSummary, {
summary: mockSurveySummaryNoData
});
expect(noDataComponent.find(".table .no-data-row")).toExist();
});
7 changes: 7 additions & 0 deletions src/__tests__/components/SideNav.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { shallowRender } from "../../utils/testHelpers";
import SideNav from "../../components/SideNav";

it("renders the scrolling nav", () => {
const component = shallowRender(SideNav);
expect(component.find(".summary__nav")).toExist();
});
7 changes: 0 additions & 7 deletions src/__tests__/components/Summary.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,10 @@ it('renders without crashing', () => {
expect(component).toExist();
});

it('renders the scrolling nav', () => {
expect(component.find('.summary__nav')).toExist();
});

it('renders the summary display', () => {
expect(component.find('.summary__display')).toExist();
});

it('renders all subsection headers', () => {
expect(component.find('.sub-section__header')).toHaveLength(17);
});

// TODO: Fix this test (it broke when React-Table was introduced)
it.skip('renders conditions and encounter diagnoses in separate tables', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/helpers/flagit.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import flagit from '../../helpers/flagit';
import summaryMap from '../../components/summary.json';
import summaryMap from '../../config/summary_config.json';
import {
mockSummaryA, mockSummaryB, mockSummaryC, mockSummaryD, mockSummaryE, mockSummaryF, mockSummaryG
} from '../../utils/testFixtures';
Expand Down
Loading

0 comments on commit 6b12fbc

Please sign in to comment.