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

Commit 62c2c59

Browse files
committed
refactor: resolve merge conflict
feat #1969
2 parents efba900 + 50f9e49 commit 62c2c59

File tree

142 files changed

+1026
-789
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

142 files changed

+1026
-789
lines changed

.eslintrc.js

+22-1
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,17 @@ module.exports = {
2828
'import/resolver': {
2929
node: {
3030
extensions: ['.js', '.jsx', '.ts', '.tsx'],
31+
moduleDirectory: ["node_modules"],
3132
},
33+
"typescript": {
34+
alwaysTryTypes: true,
35+
}
36+
},
37+
'import/parsers': {
38+
'@typescript-eslint/parser': ['.ts', '.tsx'],
3239
},
3340
},
34-
plugins: ['react', '@typescript-eslint', 'prettier', 'jest'],
41+
plugins: ['react', '@typescript-eslint', 'prettier', 'jest', 'import'],
3542
rules: {
3643
'prettier/prettier': 'error',
3744
'@typescript-eslint/member-delimiter-style': 'off',
@@ -47,12 +54,26 @@ module.exports = {
4754
'arrow-body-style': ['warn', 'as-needed'],
4855
'no-param-reassign': ['error', { props: false }],
4956
'import/prefer-default-export': 'off',
57+
'import/no-cycle': 'off',
5058
'no-console': 'off',
5159
'eol-last': ['error', 'always'],
5260
'no-debugger': 'error',
5361
'no-nested-ternary': 'off',
5462
'import/no-unresolved': 'off',
5563
'import/extensions': ['error', 'never'],
64+
'import/order': ["error", {
65+
"groups": [
66+
"external",
67+
["sibling","parent","internal"],
68+
"builtin",
69+
"unknown",
70+
],
71+
"newlines-between": "always",
72+
"alphabetize": {
73+
"order": 'asc',
74+
"caseInsensitive": true,
75+
},
76+
}],
5677
curly: ['error', 'all'],
5778
},
5879
}

package.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,9 @@
8585
"eslint": "~6.8.0",
8686
"eslint-config-airbnb": "~18.1.0",
8787
"eslint-config-prettier": "~6.11.0",
88-
"eslint-plugin-import": "~2.20.0",
89-
"eslint-plugin-jest": "~23.10.0",
88+
"eslint-import-resolver-typescript": "~2.0.0",
89+
"eslint-plugin-import": "~2.20.2",
90+
"eslint-plugin-jest": "~23.13.0",
9091
"eslint-plugin-jsx-a11y": "~6.2.3",
9192
"eslint-plugin-prettier": "~3.1.2",
9293
"eslint-plugin-react": "~7.20.0",

src/App.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1+
import { Spinner } from '@hospitalrun/components'
12
import React, { Suspense } from 'react'
2-
import { BrowserRouter } from 'react-router-dom'
33
import { Provider } from 'react-redux'
4-
import { Spinner } from '@hospitalrun/components'
5-
import HospitalRun from './HospitalRun'
4+
import { BrowserRouter } from 'react-router-dom'
65

6+
import HospitalRun from './HospitalRun'
77
import store from './store'
88

99
const App: React.FC = () => (

src/HospitalRun.tsx

+11-10
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
1+
import { Toaster } from '@hospitalrun/components'
12
import React from 'react'
2-
import { Switch, Route } from 'react-router-dom'
33
import { useSelector } from 'react-redux'
4-
import { Toaster } from '@hospitalrun/components'
5-
import Breadcrumbs from 'breadcrumbs/Breadcrumbs'
6-
import { ButtonBarProvider } from 'page-header/ButtonBarProvider'
7-
import ButtonToolBar from 'page-header/ButtonToolBar'
8-
import Labs from 'labs/Labs'
9-
import Sidebar from './components/Sidebar'
10-
import Dashboard from './dashboard/Dashboard'
11-
import { RootState } from './store'
4+
import { Switch, Route } from 'react-router-dom'
5+
6+
import Breadcrumbs from './breadcrumbs/Breadcrumbs'
127
import Navbar from './components/Navbar'
138
import PrivateRoute from './components/PrivateRoute'
14-
import Patients from './patients/Patients'
9+
import Sidebar from './components/Sidebar'
10+
import Dashboard from './dashboard/Dashboard'
1511
import Incidents from './incidents/Incidents'
12+
import Labs from './labs/Labs'
13+
import { ButtonBarProvider } from './page-header/ButtonBarProvider'
14+
import ButtonToolBar from './page-header/ButtonToolBar'
15+
import Patients from './patients/Patients'
1616
import Appointments from './scheduling/appointments/Appointments'
17+
import { RootState } from './store'
1718

1819
const HospitalRun = () => {
1920
const { title } = useSelector((state: RootState) => state.title)

src/__tests__/App.test.tsx

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import '../__mocks__/matchMediaMock'
2-
import React from 'react'
2+
33
import { mount } from 'enzyme'
4-
import HospitalRun from '../HospitalRun'
4+
import React from 'react'
5+
56
import App from '../App'
7+
import HospitalRun from '../HospitalRun'
68

79
it('renders without crashing', () => {
810
const wrapper = mount(<App />)

src/__tests__/HospitalRun.test.tsx

+22-19
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,25 @@
11
import '../__mocks__/matchMediaMock'
2-
import React from 'react'
2+
3+
import { Toaster } from '@hospitalrun/components'
34
import { mount } from 'enzyme'
4-
import { MemoryRouter } from 'react-router-dom'
5+
import React from 'react'
6+
import { act } from 'react-dom/test-utils'
57
import { Provider } from 'react-redux'
8+
import { MemoryRouter } from 'react-router-dom'
9+
import createMockStore from 'redux-mock-store'
610
import thunk from 'redux-thunk'
7-
import configureMockStore from 'redux-mock-store'
8-
import { Toaster } from '@hospitalrun/components'
9-
import { act } from 'react-dom/test-utils'
10-
import Dashboard from 'dashboard/Dashboard'
11-
import ViewLabs from 'labs/ViewLabs'
12-
import LabRepository from 'clients/db/LabRepository'
13-
import { addBreadcrumbs } from 'breadcrumbs/breadcrumbs-slice'
14-
import Appointments from 'scheduling/appointments/Appointments'
11+
12+
import { addBreadcrumbs } from '../breadcrumbs/breadcrumbs-slice'
13+
import LabRepository from '../clients/db/LabRepository'
14+
import Dashboard from '../dashboard/Dashboard'
1515
import HospitalRun from '../HospitalRun'
16-
import Permissions from '../model/Permissions'
1716
import Incidents from '../incidents/Incidents'
17+
import ViewLabs from '../labs/ViewLabs'
18+
import Permissions from '../model/Permissions'
19+
import Appointments from '../scheduling/appointments/Appointments'
20+
import { RootState } from '../store'
1821

19-
const mockStore = configureMockStore([thunk])
22+
const mockStore = createMockStore<RootState, any>([thunk])
2023

2124
describe('HospitalRun', () => {
2225
describe('routing', () => {
@@ -29,7 +32,7 @@ describe('HospitalRun', () => {
2932
breadcrumbs: { breadcrumbs: [] },
3033
components: { sidebarCollapsed: false },
3134
incidents: { incidents: [] },
32-
})
35+
} as any)
3336

3437
const wrapper = mount(
3538
<Provider store={store}>
@@ -61,7 +64,7 @@ describe('HospitalRun', () => {
6164
user: { permissions: [] },
6265
breadcrumbs: { breadcrumbs: [] },
6366
components: { sidebarCollapsed: false },
64-
})}
67+
} as any)}
6568
>
6669
<MemoryRouter initialEntries={['/appointments']}>
6770
<HospitalRun />
@@ -82,7 +85,7 @@ describe('HospitalRun', () => {
8285
labs: { labs: [] },
8386
breadcrumbs: { breadcrumbs: [] },
8487
components: { sidebarCollapsed: false },
85-
})
88+
} as any)
8689

8790
let wrapper: any
8891
await act(async () => {
@@ -106,7 +109,7 @@ describe('HospitalRun', () => {
106109
user: { permissions: [] },
107110
breadcrumbs: { breadcrumbs: [] },
108111
components: { sidebarCollapsed: false },
109-
})
112+
} as any)
110113

111114
const wrapper = mount(
112115
<Provider store={store}>
@@ -129,7 +132,7 @@ describe('HospitalRun', () => {
129132
breadcrumbs: { breadcrumbs: [] },
130133
components: { sidebarCollapsed: false },
131134
incidents: { incidents: [] },
132-
})
135+
} as any)
133136

134137
let wrapper: any
135138
await act(async () => {
@@ -153,7 +156,7 @@ describe('HospitalRun', () => {
153156
user: { permissions: [] },
154157
breadcrumbs: { breadcrumbs: [] },
155158
components: { sidebarCollapsed: false },
156-
})
159+
} as any)
157160

158161
const wrapper = mount(
159162
<Provider store={store}>
@@ -178,7 +181,7 @@ describe('HospitalRun', () => {
178181
user: { permissions: [Permissions.WritePatients] },
179182
breadcrumbs: { breadcrumbs: [] },
180183
components: { sidebarCollapsed: false },
181-
})}
184+
} as any)}
182185
>
183186
<MemoryRouter initialEntries={['/']}>
184187
<HospitalRun />

src/__tests__/breadcrumbs/Breadcrumbs.test.tsx

+12-10
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,28 @@
11
import '../../__mocks__/matchMediaMock'
2-
import React from 'react'
3-
import { Provider } from 'react-redux'
4-
import { mount } from 'enzyme'
5-
import { createMemoryHistory } from 'history'
6-
import { Router } from 'react-router-dom'
7-
import configureMockStore from 'redux-mock-store'
82
import {
93
Breadcrumb as HRBreadcrumb,
104
BreadcrumbItem as HRBreadcrumbItem,
115
} from '@hospitalrun/components'
6+
import { mount } from 'enzyme'
7+
import { createMemoryHistory } from 'history'
8+
import React from 'react'
9+
import { Provider } from 'react-redux'
10+
import { Router } from 'react-router-dom'
11+
import createMockStore from 'redux-mock-store'
12+
import thunk from 'redux-thunk'
1213

13-
import Breadcrumbs from 'breadcrumbs/Breadcrumbs'
14-
import Breadcrumb from 'model/Breadcrumb'
14+
import Breadcrumbs from '../../breadcrumbs/Breadcrumbs'
15+
import Breadcrumb from '../../model/Breadcrumb'
16+
import { RootState } from '../../store'
1517

16-
const mockStore = configureMockStore()
18+
const mockStore = createMockStore<RootState, any>([thunk])
1719

1820
describe('Breadcrumbs', () => {
1921
const setup = (breadcrumbs: Breadcrumb[]) => {
2022
const history = createMemoryHistory()
2123
const store = mockStore({
2224
breadcrumbs: { breadcrumbs },
23-
})
25+
} as any)
2426

2527
const wrapper = mount(
2628
<Provider store={store}>

src/__tests__/breadcrumbs/breadcrumbs-slice.test.ts

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import '../../__mocks__/matchMediaMock'
2+
23
import { AnyAction } from 'redux'
4+
35
import breadcrumbs, { addBreadcrumbs, removeBreadcrumbs } from '../../breadcrumbs/breadcrumbs-slice'
46

57
describe('breadcrumbs slice', () => {

src/__tests__/breadcrumbs/useAddBreadcrumbs.test.tsx

+10-7
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
1-
import React from 'react'
21
import { renderHook } from '@testing-library/react-hooks'
3-
import configureMockStore from 'redux-mock-store'
2+
import React from 'react'
43
import { Provider } from 'react-redux'
5-
import useAddBreadcrumbs from '../../breadcrumbs/useAddBreadcrumbs'
4+
import createMockStore from 'redux-mock-store'
5+
import thunk from 'redux-thunk'
6+
67
import * as breadcrumbsSlice from '../../breadcrumbs/breadcrumbs-slice'
8+
import useAddBreadcrumbs from '../../breadcrumbs/useAddBreadcrumbs'
9+
import { RootState } from '../../store'
710

8-
const store = configureMockStore()
11+
const mockStore = createMockStore<RootState, any>([thunk])
912

1013
describe('useAddBreadcrumbs', () => {
1114
beforeEach(() => jest.clearAllMocks())
1215

1316
it('should call addBreadcrumbs with the correct data', () => {
14-
const wrapper = ({ children }: any) => <Provider store={store({})}>{children}</Provider>
17+
const wrapper = ({ children }: any) => <Provider store={mockStore({})}>{children}</Provider>
1518

1619
jest.spyOn(breadcrumbsSlice, 'addBreadcrumbs')
1720
const breadcrumbs = [
@@ -27,7 +30,7 @@ describe('useAddBreadcrumbs', () => {
2730
})
2831

2932
it('should call addBreadcrumbs with an additional dashboard breadcrumb', () => {
30-
const wrapper = ({ children }: any) => <Provider store={store({})}>{children}</Provider>
33+
const wrapper = ({ children }: any) => <Provider store={mockStore({})}>{children}</Provider>
3134

3235
jest.spyOn(breadcrumbsSlice, 'addBreadcrumbs')
3336
const breadcrumbs = [
@@ -46,7 +49,7 @@ describe('useAddBreadcrumbs', () => {
4649
})
4750

4851
it('should call removeBreadcrumbs with the correct data after unmount', () => {
49-
const wrapper = ({ children }: any) => <Provider store={store({})}>{children}</Provider>
52+
const wrapper = ({ children }: any) => <Provider store={mockStore({})}>{children}</Provider>
5053

5154
jest.spyOn(breadcrumbsSlice, 'addBreadcrumbs')
5255
jest.spyOn(breadcrumbsSlice, 'removeBreadcrumbs')

src/__tests__/clients/db/AppointmentRepository.test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import AppointmentRepository from 'clients/db/AppointmentRepository'
2-
import { appointments, patients } from 'config/pouchdb'
3-
import Appointment from 'model/Appointment'
1+
import AppointmentRepository from '../../../clients/db/AppointmentRepository'
2+
import { appointments, patients } from '../../../config/pouchdb'
3+
import Appointment from '../../../model/Appointment'
44

55
const uuidV4Regex = /^[A-F\d]{8}-[A-F\d]{4}-4[A-F\d]{3}-[89AB][A-F\d]{3}-[A-F\d]{12}$/i
66

src/__tests__/clients/db/LabRepository.test.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
/* eslint "@typescript-eslint/camelcase": "off" */
2+
23
import shortid from 'shortid'
3-
import { labs } from 'config/pouchdb'
4-
import LabRepository from 'clients/db/LabRepository'
5-
import SortRequest from 'clients/db/SortRequest'
4+
5+
import LabRepository from '../../../clients/db/LabRepository'
6+
import SortRequest from '../../../clients/db/SortRequest'
7+
import { labs } from '../../../config/pouchdb'
68
import Lab from '../../../model/Lab'
79

810
interface SearchContainer {

src/__tests__/clients/db/PatientRepository.test.ts

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
import { patients } from 'config/pouchdb'
2-
import PatientRepository from 'clients/db/PatientRepository'
3-
import Patient from 'model/Patient'
4-
import shortid from 'shortid'
51
import { getTime, isAfter } from 'date-fns'
6-
import SortRequest from 'clients/db/SortRequest'
7-
import PageRequest, { UnpagedRequest } from 'clients/db/PageRequest'
2+
import shortid from 'shortid'
3+
4+
import PageRequest, { UnpagedRequest } from '../../../clients/db/PageRequest'
5+
import PatientRepository from '../../../clients/db/PatientRepository'
6+
import SortRequest from '../../../clients/db/SortRequest'
7+
import { patients } from '../../../config/pouchdb'
8+
import Patient from '../../../model/Patient'
89

910
const uuidV4Regex = /^[A-F\d]{8}-[A-F\d]{4}-4[A-F\d]{3}-[89AB][A-F\d]{3}-[A-F\d]{12}$/i
1011

src/__tests__/components/Navbar.test.tsx

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import '../../__mocks__/matchMediaMock'
2-
import React from 'react'
3-
import { Router } from 'react-router-dom'
4-
import { mount } from 'enzyme'
2+
53
import { Navbar as HospitalRunNavbar } from '@hospitalrun/components'
6-
import { act } from 'react-dom/test-utils'
4+
import { mount } from 'enzyme'
75
import { createMemoryHistory } from 'history'
6+
import React from 'react'
7+
import { act } from 'react-dom/test-utils'
8+
import { Router } from 'react-router-dom'
9+
810
import Navbar from '../../components/Navbar'
911

1012
describe('Navbar', () => {

src/__tests__/components/Sidebar.test.tsx

+11-8
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,25 @@
11
import '../../__mocks__/matchMediaMock'
2-
import React from 'react'
2+
3+
import { ListItem } from '@hospitalrun/components'
4+
import { act } from '@testing-library/react'
35
import { mount } from 'enzyme'
46
import { createMemoryHistory } from 'history'
5-
import Sidebar from 'components/Sidebar'
7+
import React from 'react'
8+
import { Provider } from 'react-redux'
69
import { Router } from 'react-router-dom'
7-
import { ListItem } from '@hospitalrun/components'
8-
import { act } from '@testing-library/react'
9-
import configureMockStore from 'redux-mock-store'
10+
import createMockStore from 'redux-mock-store'
1011
import thunk from 'redux-thunk'
11-
import { Provider } from 'react-redux'
1212

13-
const mockStore = configureMockStore([thunk])
13+
import Sidebar from '../../components/Sidebar'
14+
import { RootState } from '../../store'
15+
16+
const mockStore = createMockStore<RootState, any>([thunk])
1417

1518
describe('Sidebar', () => {
1619
let history = createMemoryHistory()
1720
const store = mockStore({
1821
components: { sidebarCollapsed: false },
19-
})
22+
} as any)
2023
const setup = (location: string) => {
2124
history = createMemoryHistory()
2225
history.push(location)

0 commit comments

Comments
 (0)