-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add tests for UI components, prettify/reformatting code, fix issues found when running tests * js lint fix * remove un-intended files * add back changes Co-authored-by: Amy Chen <clone@cesium.cirg.washington.edu>
- Loading branch information
Showing
36 changed files
with
5,003 additions
and
3,473 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import "jest-canvas-mock"; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Testing UI components | ||
|
||
Before running test, make sure all dependencies are installed. Run `npm install` to install all dependencies | ||
|
||
To run (do so from the root directory): | ||
`npm run test` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { shallow } from "enzyme"; | ||
import React from "react"; | ||
import Agreement from "../../js/components/Agreement"; | ||
|
||
describe("Agreement", () => { | ||
it("Agreement component renders without crashing", () => { | ||
const rowData = { | ||
id: 158, | ||
first_name: "Luke", | ||
last_name: "Skywalker", | ||
dob: "1977-01-12" | ||
}; | ||
const wrapper = shallow(<Agreement rowData={rowData}/>); | ||
expect(wrapper).toBeDefined(); | ||
}); | ||
}); |
10 changes: 10 additions & 0 deletions
10
patientsearch/src/__tests__/components/DetailPanel.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { shallow } from "enzyme"; | ||
import React from "react"; | ||
import DetailPanel from "../../js/components/DetailPanel"; | ||
|
||
describe("DetailPanel", () => { | ||
it("DetailPanel component renders without crashing", () => { | ||
const wrapper = shallow(<DetailPanel />); | ||
expect(wrapper).toBeDefined(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { shallow } from "enzyme"; | ||
import React from "react"; | ||
import DialogBox from "../../js/components/DialogBox"; | ||
|
||
describe("DialogBox", () => { | ||
it("DialogBox component renders without crashing", () => { | ||
const wrapper = shallow(<DialogBox />); | ||
expect(wrapper).toBeDefined(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { shallow } from "enzyme"; | ||
import React from "react"; | ||
import Dropdown from "../../js/components/Dropdown"; | ||
|
||
describe("Dropdown", () => { | ||
it("Dropdown component renders without crashing", () => { | ||
const menuItems = [{"id": "test", "text": "test"}]; | ||
const wrapper = shallow(<Dropdown menuItems={menuItems} />); | ||
expect(wrapper).toBeDefined(); | ||
}); | ||
|
||
it("Empty Dropdown component renders without crashing", () => { | ||
const wrapper = shallow(<Dropdown/>); | ||
expect(wrapper).toEqual({}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { shallow } from "enzyme"; | ||
import React from "react"; | ||
import Error from "../../js/components/Error"; | ||
|
||
describe("Error", () => { | ||
it("Error component renders without crashing", () => { | ||
const wrapper = shallow(<Error />); | ||
expect(wrapper).toBeDefined(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { shallow } from "enzyme"; | ||
import React from "react"; | ||
import FilterRow from "../../js/components/FilterRow"; | ||
|
||
describe("FilterRow", () => { | ||
it("FilterRow component renders without crashing", () => { | ||
const wrapper = shallow( | ||
<FilterRow | ||
onFiltersDidChange={() => { | ||
console.log("Get to filter did change function."); | ||
}} | ||
/> | ||
); | ||
expect(wrapper).toBeDefined(); | ||
}); | ||
}); |
10 changes: 10 additions & 0 deletions
10
patientsearch/src/__tests__/components/FormattedInput.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { shallow } from "enzyme"; | ||
import React from "react"; | ||
import FormattedInput from "../../js/components/FormattedInput"; | ||
|
||
describe("FormattedInput", () => { | ||
it("FormattedInput component renders without crashing", () => { | ||
const wrapper = shallow(<FormattedInput />); | ||
expect(wrapper).toBeDefined(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { shallow } from "enzyme"; | ||
import React from "react"; | ||
import Header from "../../js/components/Header"; | ||
|
||
describe("Header", () => { | ||
it("Header render without crashing", () => { | ||
const wrapperLogout = shallow(<Header></Header>); | ||
expect(wrapperLogout).toBeDefined(); | ||
}); | ||
it("contains logo image", () => { | ||
expect(document.querySelector("img")).toBeDefined(); | ||
}); | ||
}); |
20 changes: 20 additions & 0 deletions
20
patientsearch/src/__tests__/components/HistoryTable.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { shallow } from "enzyme"; | ||
import React from "react"; | ||
import HistoryTable from "../../js/components/HistoryTable"; | ||
|
||
describe("History table", () => { | ||
it("History table component renders without crashing", () => { | ||
const data = [{ | ||
id: 158, | ||
first_name: "Luke", | ||
last_name: "Skywalker", | ||
dob: "1977-01-12" | ||
}]; | ||
const columns = [{ | ||
"field": "id" | ||
}]; | ||
const apiURL = "/fhir"; | ||
const wrapper = shallow(<HistoryTable data={data} columns={columns} APIURL={apiURL}/>); | ||
expect(wrapper).toBeDefined(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { shallow } from "enzyme"; | ||
import React from "react"; | ||
import Info from "../../js/components/Info"; | ||
|
||
describe("Info", () => { | ||
it("Info component renders without crashing", () => { | ||
const wrapper = shallow(<Info />); | ||
expect(wrapper).toBeDefined(); | ||
}); | ||
}); |
14 changes: 14 additions & 0 deletions
14
patientsearch/src/__tests__/components/OverdueAlert.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { shallow } from "enzyme"; | ||
import React from "react"; | ||
import OverdueAlert from "../../js/components/OverdueAlert"; | ||
|
||
describe("OverdueAlert", () => { | ||
it("OverdueAlert component renders without crashing", () => { | ||
const wrapper = shallow(<OverdueAlert date="2021-01-01" type="test"/>); | ||
expect(wrapper).toBeDefined(); | ||
}); | ||
it("Empty OverdueAlert component", () => { | ||
const wrapper = shallow(<OverdueAlert date="2050-02-02" type="test"/>); | ||
expect(wrapper).toEqual({}); | ||
}); | ||
}); |
10 changes: 10 additions & 0 deletions
10
patientsearch/src/__tests__/components/PatientListTable.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { shallow } from "enzyme"; | ||
import React from "react"; | ||
import PatientListTable from "../../js/components/PatientListTable"; | ||
|
||
describe("PatientListTable", () => { | ||
it("Patient list renders without crashing", () => { | ||
const wrapper = shallow(<PatientListTable />); | ||
expect(wrapper).toBeDefined(); | ||
}); | ||
}); |
17 changes: 17 additions & 0 deletions
17
patientsearch/src/__tests__/components/SystemBanner.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { shallow } from "enzyme"; | ||
import React from "react"; | ||
import SystemBanner from "../../js/components/SystemBanner"; | ||
|
||
describe("SystemBanner", () => { | ||
it("SystemBanner component renders without crashing", () => { | ||
const wrapper = shallow(<SystemBanner systemType="development" />); | ||
expect(wrapper).toBeDefined(); | ||
}); | ||
}); | ||
|
||
describe("SystemBanner", () => { | ||
it("Empty SystemBanner component renders without crashing", () => { | ||
const wrapper = shallow(<SystemBanner/>); | ||
expect(wrapper).toEqual({}); | ||
}); | ||
}); |
10 changes: 10 additions & 0 deletions
10
patientsearch/src/__tests__/components/TimeoutModal.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { shallow } from "enzyme"; | ||
import React from "react"; | ||
import TimeoutModal from "../../js/components/TimeoutModal"; | ||
|
||
describe("TimeoutModal", () => { | ||
it("TimeoutModal component renders without crashing", () => { | ||
const wrapper = shallow(<TimeoutModal />); | ||
expect(wrapper).toBeDefined(); | ||
}); | ||
}); |
16 changes: 16 additions & 0 deletions
16
patientsearch/src/__tests__/components/UrineScreen.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { shallow } from "enzyme"; | ||
import React from "react"; | ||
import UrineScreen from "../../js/components/UrineScreen"; | ||
|
||
describe("UrineScreen", () => { | ||
it("Urine screen component renders without crashing", () => { | ||
const rowData = { | ||
id: 158, | ||
first_name: "Luke", | ||
last_name: "Skywalker", | ||
dob: "1977-01-12" | ||
}; | ||
const wrapper = shallow(<UrineScreen rowData={rowData}/>); | ||
expect(wrapper).toBeDefined(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { shallow } from "enzyme"; | ||
import React from "react"; | ||
import Version from "../../js/components/Version"; | ||
|
||
describe("Version", () => { | ||
it("Version component renders without crashing", () => { | ||
const wrapper = shallow(<Version version={"1.1"} />); | ||
expect(wrapper).toBeDefined(); | ||
}); | ||
it("Empty Version component", () => { | ||
const wrapper = shallow(<Version />); | ||
expect(wrapper).toEqual({}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { shallow } from "enzyme"; | ||
import React from "react"; | ||
import App from "../../js/containers/App"; | ||
|
||
describe("App", () => { | ||
it("App container component renders without crashing", () => { | ||
const wrapper = shallow(<App />); | ||
expect(wrapper).toBeDefined(); | ||
}); | ||
}); |
Oops, something went wrong.