Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

Commit

Permalink
resolve(patients): merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
oizuldan committed Mar 10, 2020
2 parents 0d4a226 + 6ca695b commit e960756
Show file tree
Hide file tree
Showing 89 changed files with 1,105 additions and 404 deletions.
7 changes: 3 additions & 4 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
module.exports = {
ignorePatterns: ['commitlint.config.js', 'jest.config.js'],
env: {
browser: true,
es6: true,
Expand All @@ -10,7 +11,7 @@ module.exports = {
'prettier',
'prettier/@typescript-eslint',
'plugin:prettier/recommended',
'eslint-config-prettier'
'eslint-config-prettier',
],
globals: {
Atomics: 'readonly',
Expand All @@ -20,8 +21,6 @@ module.exports = {
parserOptions: {
project: './tsconfig.json',
tsconfigRootDir: './',
// TODO: we need this because of an issue with @typescript-eslint/parser: https://github.com/typescript-eslint/typescript-eslint/issues/864
createDefaultProgram: true,
},
settings: {
'import/resolver': {
Expand All @@ -32,7 +31,7 @@ module.exports = {
},
plugins: ['react', '@typescript-eslint', 'prettier', 'jest'],
rules: {
"prettier/prettier": "error",
'prettier/prettier': 'error',
'@typescript-eslint/member-delimiter-style': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-explicit-any': 'off',
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
node-version: [12.x, 13.x]
node-version: [12.x]
os: [ubuntu-latest, windows-latest, macOS-latest]
# exclude:
# - os: windows-latest
Expand Down Expand Up @@ -41,7 +41,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
node-version: [12.x, 13.x]
node-version: [12.x]
os: [ubuntu-latest, windows-latest, macOS-latest]
# exclude:
# - os: windows-latest
Expand Down
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ before_script:
- npm run lint
script:
- npm run build
after_script:
- COVERALLS_REPO_TOKEN=$coveralls_repo_token npm run coveralls

notifications:
email:
on_success: never
Expand Down
3 changes: 2 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
module.exports = {
roots: ['<rootDir>/src'],
testMatch: ['**/__tests__/**/*.+(ts|tsx|js)', '**/?(*.)+(spec|test).+(ts|tsx|js)'],
testMatch: ['**/__tests__/**/*.+(ts|tsx)', '**/?(*.)+(spec|test).+(ts|tsx)'],
transform: {
'^.+\\.(ts|tsx)$': 'ts-jest',
},
coverageDirectory: './coverage',
testPathIgnorePatterns: ['<rootDir>/jest.config.js'],
}
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"private": false,
"license": "MIT",
"dependencies": {
"@hospitalrun/components": "^0.34.0",
"@hospitalrun/components": "^0.35.0",
"@reduxjs/toolkit": "~1.2.1",
"@types/pouchdb-find": "~6.3.4",
"bootstrap": "~4.4.1",
Expand Down Expand Up @@ -50,7 +50,7 @@
"@testing-library/react": "~9.5.0",
"@testing-library/react-hooks": "~3.2.1",
"@types/jest": "~25.1.0",
"@types/node": "~13.7.0",
"@types/node": "~13.9.0",
"@types/pouchdb": "~6.4.0",
"@types/react": "~16.9.17",
"@types/react-dom": "~16.9.4",
Expand All @@ -60,8 +60,8 @@
"@types/redux-mock-store": "~1.0.1",
"@types/shortid": "^0.0.29",
"@types/uuid": "^7.0.0",
"@typescript-eslint/eslint-plugin": "~2.22.0",
"@typescript-eslint/parser": "~2.22.0",
"@typescript-eslint/eslint-plugin": "~2.23.0",
"@typescript-eslint/parser": "~2.23.0",
"commitizen": "~4.0.3",
"commitlint-config-cz": "~0.13.0",
"coveralls": "~3.0.9",
Expand All @@ -77,7 +77,7 @@
"eslint-plugin-jest": "~23.8.0",
"eslint-plugin-jsx-a11y": "~6.2.3",
"eslint-plugin-prettier": "~3.1.1",
"eslint-plugin-react": "~7.18.0",
"eslint-plugin-react": "~7.19.0",
"eslint-plugin-react-hooks": "~2.5.0",
"history": "~4.10.1",
"husky": "~4.2.1",
Expand All @@ -97,7 +97,7 @@
"build": "react-scripts build",
"prepublishOnly": "npm run build",
"test": "react-scripts test --detectOpenHandles",
"test:ci": "cross-env CI=true react-scripts test",
"test:ci": "cross-env CI=true react-scripts test --passWithNoTests",
"lint": "eslint \"src/**/*.{js,jsx,ts,tsx}\"",
"lint:fix": "eslint \"src/**/*.{js,jsx,ts,tsx}\" --fix",
"lint-staged": "lint-staged",
Expand Down
8 changes: 7 additions & 1 deletion src/HospitalRun.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import PrivateRoute from './components/PrivateRoute'
const HospitalRun = () => {
const { title } = useSelector((state: RootState) => state.title)
const { permissions } = useSelector((state: RootState) => state.user)
const { sidebarCollapsed } = useSelector((state: RootState) => state.components)

return (
<div>
Expand All @@ -31,7 +32,12 @@ const HospitalRun = () => {
<Sidebar />
<ButtonBarProvider>
<div className="row">
<main role="main" className="col-md-9 ml-sm-auto col-lg-10 px-4">
<main
role="main"
className={`${
sidebarCollapsed ? 'col-md-10 col-lg-11' : 'col-md-9 col-lg-10'
} ml-sm-auto px-4`}
>
<div className="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
<h1 className="h2">{title}</h1>
<ButtonToolBar />
Expand Down
17 changes: 16 additions & 1 deletion src/__tests__/HospitalRun.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ describe('HospitalRun', () => {
title: 'test',
user: { permissions: [Permissions.WritePatients] },
breadcrumbs: { breadcrumbs: [] },
components: { sidebarCollapsed: false },
})

const wrapper = mount(
Expand Down Expand Up @@ -62,6 +63,7 @@ describe('HospitalRun', () => {
title: 'test',
user: { permissions: [] },
breadcrumbs: { breadcrumbs: [] },
components: { sidebarCollapsed: false },
})}
>
<MemoryRouter initialEntries={['/patients/new']}>
Expand Down Expand Up @@ -94,6 +96,7 @@ describe('HospitalRun', () => {
user: { permissions: [Permissions.WritePatients, Permissions.ReadPatients] },
patient: { patient },
breadcrumbs: { breadcrumbs: [] },
components: { sidebarCollapsed: false },
})

const wrapper = mount(
Expand Down Expand Up @@ -123,6 +126,7 @@ describe('HospitalRun', () => {
title: 'test',
user: { permissions: [Permissions.WritePatients] },
breadcrumbs: { breadcrumbs: [] },
components: { sidebarCollapsed: false },
})}
>
<MemoryRouter initialEntries={['/patients/edit/123']}>
Expand All @@ -141,6 +145,7 @@ describe('HospitalRun', () => {
title: 'test',
user: { permissions: [Permissions.ReadPatients] },
breadcrumbs: { breadcrumbs: [] },
components: { sidebarCollapsed: false },
})}
>
<MemoryRouter initialEntries={['/patients/edit/123']}>
Expand Down Expand Up @@ -173,6 +178,7 @@ describe('HospitalRun', () => {
user: { permissions: [Permissions.ReadPatients] },
patient: { patient },
breadcrumbs: { breadcrumbs: [] },
components: { sidebarCollapsed: false },
})

const wrapper = mount(
Expand Down Expand Up @@ -201,6 +207,7 @@ describe('HospitalRun', () => {
title: 'test',
user: { permissions: [] },
breadcrumbs: { breadcrumbs: [] },
components: { sidebarCollapsed: false },
})}
>
<MemoryRouter initialEntries={['/patients/123']}>
Expand All @@ -220,6 +227,7 @@ describe('HospitalRun', () => {
user: { permissions: [Permissions.ReadAppointments] },
appointments: { appointments: [] },
breadcrumbs: { breadcrumbs: [] },
components: { sidebarCollapsed: false },
})

const wrapper = mount(
Expand Down Expand Up @@ -251,6 +259,7 @@ describe('HospitalRun', () => {
title: 'test',
user: { permissions: [] },
breadcrumbs: { breadcrumbs: [] },
components: { sidebarCollapsed: false },
})}
>
<MemoryRouter initialEntries={['/appointments']}>
Expand All @@ -269,6 +278,7 @@ describe('HospitalRun', () => {
title: 'test',
user: { permissions: [Permissions.WriteAppointments] },
breadcrumbs: { breadcrumbs: [] },
components: { sidebarCollapsed: false },
})

const wrapper = mount(
Expand All @@ -285,7 +295,7 @@ describe('HospitalRun', () => {
expect(store.getActions()).toContainEqual(
addBreadcrumbs([
{ i18nKey: 'scheduling.appointments.label', location: '/appointments' },
{ i18nKey: 'scheduling.appointments.newAppointment', location: '/appointments/new' },
{ i18nKey: 'scheduling.appointments.new', location: '/appointments/new' },
{ i18nKey: 'dashboard.label', location: '/' },
]),
)
Expand All @@ -298,6 +308,7 @@ describe('HospitalRun', () => {
title: 'test',
user: { permissions: [] },
breadcrumbs: { breadcrumbs: [] },
components: { sidebarCollapsed: false },
})}
>
<MemoryRouter initialEntries={['/appointments/new']}>
Expand Down Expand Up @@ -332,6 +343,7 @@ describe('HospitalRun', () => {
user: { permissions: [Permissions.WriteAppointments, Permissions.ReadAppointments] },
appointment: { appointment, patient: {} as Patient },
breadcrumbs: { breadcrumbs: [] },
components: { sidebarCollapsed: false },
})

const wrapper = mount(
Expand Down Expand Up @@ -364,6 +376,7 @@ describe('HospitalRun', () => {
title: 'test',
user: { permissions: [Permissions.WriteAppointments] },
breadcrumbs: { breadcrumbs: [] },
components: { sidebarCollapsed: false },
})}
>
<MemoryRouter initialEntries={['/appointments/edit/123']}>
Expand All @@ -382,6 +395,7 @@ describe('HospitalRun', () => {
title: 'test',
user: { permissions: [Permissions.ReadAppointments] },
breadcrumbs: { breadcrumbs: [] },
components: { sidebarCollapsed: false },
})}
>
<MemoryRouter initialEntries={['/appointments/edit/123']}>
Expand All @@ -403,6 +417,7 @@ describe('HospitalRun', () => {
title: 'test',
user: { permissions: [Permissions.WritePatients] },
breadcrumbs: { breadcrumbs: [] },
components: { sidebarCollapsed: false },
})}
>
<MemoryRouter initialEntries={['/']}>
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/components/Navbar.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ describe('Navbar', () => {
'scheduling.appointments.label',
)
expect(scheduleLinkList.first().props().children[1].props.children).toEqual(
'scheduling.appointments.newAppointment',
'scheduling.appointments.new',
)
})

Expand Down
30 changes: 20 additions & 10 deletions src/__tests__/components/Sidebar.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,25 @@ import Sidebar from 'components/Sidebar'
import { Router } from 'react-router'
import { ListItem } from '@hospitalrun/components'
import { act } from '@testing-library/react'
import configureMockStore from 'redux-mock-store'
import thunk from 'redux-thunk'
import { Provider } from 'react-redux'

const mockStore = configureMockStore([thunk])

describe('Sidebar', () => {
let history = createMemoryHistory()
const store = mockStore({
components: { sidebarCollapsed: false },
})
const setup = (location: string) => {
history = createMemoryHistory()
history.push(location)
return mount(
<Router history={history}>
<Sidebar />
<Provider store={store}>
<Sidebar />
</Provider>
</Router>,
)
}
Expand All @@ -27,7 +37,7 @@ describe('Sidebar', () => {

expect(
listItems
.at(0)
.at(1)
.text()
.trim(),
).toEqual('dashboard.label')
Expand All @@ -38,7 +48,7 @@ describe('Sidebar', () => {

const listItems = wrapper.find(ListItem)

expect(listItems.at(0).prop('active')).toBeTruthy()
expect(listItems.at(1).prop('active')).toBeTruthy()
})

it('should navigate to / when the dashboard link is clicked', () => {
Expand All @@ -47,7 +57,7 @@ describe('Sidebar', () => {
const listItems = wrapper.find(ListItem)

act(() => {
;(listItems.at(0).prop('onClick') as any)()
;(listItems.at(1).prop('onClick') as any)()
})

expect(history.location.pathname).toEqual('/')
Expand All @@ -62,7 +72,7 @@ describe('Sidebar', () => {

expect(
listItems
.at(1)
.at(2)
.text()
.trim(),
).toEqual('patients.label')
Expand All @@ -73,7 +83,7 @@ describe('Sidebar', () => {

const listItems = wrapper.find(ListItem)

expect(listItems.at(1).prop('active')).toBeTruthy()
expect(listItems.at(2).prop('active')).toBeTruthy()
})

it('should navigate to /patients when the patients link is clicked', () => {
Expand All @@ -82,7 +92,7 @@ describe('Sidebar', () => {
const listItems = wrapper.find(ListItem)

act(() => {
;(listItems.at(1).prop('onClick') as any)()
;(listItems.at(2).prop('onClick') as any)()
})

expect(history.location.pathname).toEqual('/patients')
Expand All @@ -97,7 +107,7 @@ describe('Sidebar', () => {

expect(
listItems
.at(2)
.at(3)
.text()
.trim(),
).toEqual('scheduling.label')
Expand All @@ -108,7 +118,7 @@ describe('Sidebar', () => {

const listItems = wrapper.find(ListItem)

expect(listItems.at(2).prop('active')).toBeTruthy()
expect(listItems.at(3).prop('active')).toBeTruthy()
})

it('should navigate to /appointments when the scheduling link is clicked', () => {
Expand All @@ -117,7 +127,7 @@ describe('Sidebar', () => {
const listItems = wrapper.find(ListItem)

act(() => {
;(listItems.at(2).prop('onClick') as any)()
;(listItems.at(3).prop('onClick') as any)()
})

expect(history.location.pathname).toEqual('/appointments')
Expand Down
Loading

0 comments on commit e960756

Please # to comment.