diff --git a/src/__tests__/HospitalRun.test.tsx b/src/__tests__/HospitalRun.test.tsx index 50120e8ea8..049e966179 100644 --- a/src/__tests__/HospitalRun.test.tsx +++ b/src/__tests__/HospitalRun.test.tsx @@ -6,7 +6,7 @@ import React from 'react' import { act } from 'react-dom/test-utils' import { Provider } from 'react-redux' import { MemoryRouter } from 'react-router-dom' -import configureMockStore from 'redux-mock-store' +import createMockStore from 'redux-mock-store' import thunk from 'redux-thunk' import { addBreadcrumbs } from '../breadcrumbs/breadcrumbs-slice' @@ -17,8 +17,9 @@ import Incidents from '../incidents/Incidents' import ViewLabs from '../labs/ViewLabs' import Permissions from '../model/Permissions' import Appointments from '../scheduling/appointments/Appointments' +import { RootState } from '../store' -const mockStore = configureMockStore([thunk]) +const mockStore = createMockStore([thunk]) describe('HospitalRun', () => { describe('routing', () => { @@ -31,7 +32,7 @@ describe('HospitalRun', () => { breadcrumbs: { breadcrumbs: [] }, components: { sidebarCollapsed: false }, incidents: { incidents: [] }, - }) + } as any) const wrapper = mount( @@ -63,7 +64,7 @@ describe('HospitalRun', () => { user: { permissions: [] }, breadcrumbs: { breadcrumbs: [] }, components: { sidebarCollapsed: false }, - })} + } as any)} > @@ -84,7 +85,7 @@ describe('HospitalRun', () => { labs: { labs: [] }, breadcrumbs: { breadcrumbs: [] }, components: { sidebarCollapsed: false }, - }) + } as any) let wrapper: any await act(async () => { @@ -108,7 +109,7 @@ describe('HospitalRun', () => { user: { permissions: [] }, breadcrumbs: { breadcrumbs: [] }, components: { sidebarCollapsed: false }, - }) + } as any) const wrapper = mount( @@ -131,7 +132,7 @@ describe('HospitalRun', () => { breadcrumbs: { breadcrumbs: [] }, components: { sidebarCollapsed: false }, incidents: { incidents: [] }, - }) + } as any) let wrapper: any await act(async () => { @@ -155,7 +156,7 @@ describe('HospitalRun', () => { user: { permissions: [] }, breadcrumbs: { breadcrumbs: [] }, components: { sidebarCollapsed: false }, - }) + } as any) const wrapper = mount( @@ -180,7 +181,7 @@ describe('HospitalRun', () => { user: { permissions: [Permissions.WritePatients] }, breadcrumbs: { breadcrumbs: [] }, components: { sidebarCollapsed: false }, - })} + } as any)} > diff --git a/src/__tests__/breadcrumbs/Breadcrumbs.test.tsx b/src/__tests__/breadcrumbs/Breadcrumbs.test.tsx index 97314e5e0f..664af2a3bd 100644 --- a/src/__tests__/breadcrumbs/Breadcrumbs.test.tsx +++ b/src/__tests__/breadcrumbs/Breadcrumbs.test.tsx @@ -1,5 +1,4 @@ import '../../__mocks__/matchMediaMock' - import { Breadcrumb as HRBreadcrumb, BreadcrumbItem as HRBreadcrumbItem, @@ -9,19 +8,21 @@ import { createMemoryHistory } from 'history' import React from 'react' import { Provider } from 'react-redux' import { Router } from 'react-router-dom' -import configureMockStore from 'redux-mock-store' +import createMockStore from 'redux-mock-store' +import thunk from 'redux-thunk' import Breadcrumbs from '../../breadcrumbs/Breadcrumbs' import Breadcrumb from '../../model/Breadcrumb' +import { RootState } from '../../store' -const mockStore = configureMockStore() +const mockStore = createMockStore([thunk]) describe('Breadcrumbs', () => { const setup = (breadcrumbs: Breadcrumb[]) => { const history = createMemoryHistory() const store = mockStore({ breadcrumbs: { breadcrumbs }, - }) + } as any) const wrapper = mount( diff --git a/src/__tests__/breadcrumbs/useAddBreadcrumbs.test.tsx b/src/__tests__/breadcrumbs/useAddBreadcrumbs.test.tsx index 8736bb1412..f67b9fd22f 100644 --- a/src/__tests__/breadcrumbs/useAddBreadcrumbs.test.tsx +++ b/src/__tests__/breadcrumbs/useAddBreadcrumbs.test.tsx @@ -1,18 +1,20 @@ import { renderHook } from '@testing-library/react-hooks' import React from 'react' import { Provider } from 'react-redux' -import configureMockStore from 'redux-mock-store' +import createMockStore from 'redux-mock-store' +import thunk from 'redux-thunk' import * as breadcrumbsSlice from '../../breadcrumbs/breadcrumbs-slice' import useAddBreadcrumbs from '../../breadcrumbs/useAddBreadcrumbs' +import { RootState } from '../../store' -const store = configureMockStore() +const mockStore = createMockStore([thunk]) describe('useAddBreadcrumbs', () => { beforeEach(() => jest.clearAllMocks()) it('should call addBreadcrumbs with the correct data', () => { - const wrapper = ({ children }: any) => {children} + const wrapper = ({ children }: any) => {children} jest.spyOn(breadcrumbsSlice, 'addBreadcrumbs') const breadcrumbs = [ @@ -28,7 +30,7 @@ describe('useAddBreadcrumbs', () => { }) it('should call addBreadcrumbs with an additional dashboard breadcrumb', () => { - const wrapper = ({ children }: any) => {children} + const wrapper = ({ children }: any) => {children} jest.spyOn(breadcrumbsSlice, 'addBreadcrumbs') const breadcrumbs = [ @@ -47,7 +49,7 @@ describe('useAddBreadcrumbs', () => { }) it('should call removeBreadcrumbs with the correct data after unmount', () => { - const wrapper = ({ children }: any) => {children} + const wrapper = ({ children }: any) => {children} jest.spyOn(breadcrumbsSlice, 'addBreadcrumbs') jest.spyOn(breadcrumbsSlice, 'removeBreadcrumbs') diff --git a/src/__tests__/components/Sidebar.test.tsx b/src/__tests__/components/Sidebar.test.tsx index 467f7ab547..285dfb41a8 100644 --- a/src/__tests__/components/Sidebar.test.tsx +++ b/src/__tests__/components/Sidebar.test.tsx @@ -7,18 +7,19 @@ import { createMemoryHistory } from 'history' import React from 'react' import { Provider } from 'react-redux' import { Router } from 'react-router-dom' -import configureMockStore from 'redux-mock-store' +import createMockStore from 'redux-mock-store' import thunk from 'redux-thunk' import Sidebar from '../../components/Sidebar' +import { RootState } from '../../store' -const mockStore = configureMockStore([thunk]) +const mockStore = createMockStore([thunk]) describe('Sidebar', () => { let history = createMemoryHistory() const store = mockStore({ components: { sidebarCollapsed: false }, - }) + } as any) const setup = (location: string) => { history = createMemoryHistory() history.push(location) diff --git a/src/__tests__/incidents/Incidents.test.tsx b/src/__tests__/incidents/Incidents.test.tsx index 1b97d83a91..ecc4626461 100644 --- a/src/__tests__/incidents/Incidents.test.tsx +++ b/src/__tests__/incidents/Incidents.test.tsx @@ -5,7 +5,7 @@ import { mount } from 'enzyme' import React from 'react' import { Provider } from 'react-redux' import { MemoryRouter } from 'react-router-dom' -import configureMockStore from 'redux-mock-store' +import createMockStore from 'redux-mock-store' import thunk from 'redux-thunk' import IncidentRepository from '../../clients/db/IncidentRepository' @@ -14,8 +14,9 @@ import ReportIncident from '../../incidents/report/ReportIncident' import ViewIncident from '../../incidents/view/ViewIncident' import Incident from '../../model/Incident' import Permissions from '../../model/Permissions' +import { RootState } from '../../store' -const mockStore = configureMockStore([thunk]) +const mockStore = createMockStore([thunk]) describe('Incidents', () => { describe('routing', () => { @@ -34,7 +35,7 @@ describe('Incidents', () => { incident: { incident: expectedIncident, }, - }) + } as any) const wrapper = mount( @@ -53,7 +54,7 @@ describe('Incidents', () => { user: { permissions: [] }, breadcrumbs: { breadcrumbs: [] }, components: { sidebarCollapsed: false }, - }) + } as any) const wrapper = mount( @@ -82,7 +83,7 @@ describe('Incidents', () => { reportedOn: new Date().toISOString(), }, }, - }) + } as any) let wrapper: any @@ -105,7 +106,7 @@ describe('Incidents', () => { user: { permissions: [] }, breadcrumbs: { breadcrumbs: [] }, components: { sidebarCollapsed: false }, - }) + } as any) const wrapper = await mount( diff --git a/src/__tests__/incidents/list/ViewIncidents.test.tsx b/src/__tests__/incidents/list/ViewIncidents.test.tsx index 0eb2502c8d..13b2fcbe9a 100644 --- a/src/__tests__/incidents/list/ViewIncidents.test.tsx +++ b/src/__tests__/incidents/list/ViewIncidents.test.tsx @@ -16,8 +16,9 @@ import Incident from '../../../model/Incident' import Permissions from '../../../model/Permissions' import * as ButtonBarProvider from '../../../page-header/ButtonBarProvider' import * as titleUtil from '../../../page-header/useTitle' +import { RootState } from '../../../store' -const mockStore = createMockStore([thunk]) +const mockStore = createMockStore([thunk]) describe('View Incidents', () => { let history: any @@ -52,7 +53,7 @@ describe('View Incidents', () => { incidents: { incidents: expectedIncidents, }, - }) + } as any) let wrapper: any await act(async () => { diff --git a/src/__tests__/incidents/report/ReportIncident.test.tsx b/src/__tests__/incidents/report/ReportIncident.test.tsx index 83fa8aef07..51a301ae30 100644 --- a/src/__tests__/incidents/report/ReportIncident.test.tsx +++ b/src/__tests__/incidents/report/ReportIncident.test.tsx @@ -16,8 +16,9 @@ import ReportIncident from '../../../incidents/report/ReportIncident' import Permissions from '../../../model/Permissions' import * as ButtonBarProvider from '../../../page-header/ButtonBarProvider' import * as titleUtil from '../../../page-header/useTitle' +import { RootState } from '../../../store' -const mockStore = createMockStore([thunk]) +const mockStore = createMockStore([thunk]) describe('Report Incident', () => { let history: any @@ -43,7 +44,7 @@ describe('Report Incident', () => { incident: { error, }, - }) + } as any) let wrapper: any await act(async () => { diff --git a/src/__tests__/incidents/view/ViewIncident.test.tsx b/src/__tests__/incidents/view/ViewIncident.test.tsx index 15a5ebeb10..d8bdeae1aa 100644 --- a/src/__tests__/incidents/view/ViewIncident.test.tsx +++ b/src/__tests__/incidents/view/ViewIncident.test.tsx @@ -16,8 +16,9 @@ import Incident from '../../../model/Incident' import Permissions from '../../../model/Permissions' import * as ButtonBarProvider from '../../../page-header/ButtonBarProvider' import * as titleUtil from '../../../page-header/useTitle' +import { RootState } from '../../../store' -const mockStore = createMockStore([thunk]) +const mockStore = createMockStore([thunk]) describe('View Incident', () => { const expectedDate = new Date(2020, 5, 1, 19, 48) @@ -52,7 +53,7 @@ describe('View Incident', () => { incident: { incident: expectedIncident, }, - }) + } as any) let wrapper: any await act(async () => { diff --git a/src/__tests__/labs/Labs.test.tsx b/src/__tests__/labs/Labs.test.tsx index d0c40ec0e7..9489b30f8c 100644 --- a/src/__tests__/labs/Labs.test.tsx +++ b/src/__tests__/labs/Labs.test.tsx @@ -5,7 +5,7 @@ import { mount } from 'enzyme' import React from 'react' import { Provider } from 'react-redux' import { MemoryRouter } from 'react-router-dom' -import configureMockStore from 'redux-mock-store' +import createMockStore from 'redux-mock-store' import thunk from 'redux-thunk' import LabRepository from '../../clients/db/LabRepository' @@ -16,8 +16,9 @@ import ViewLab from '../../labs/ViewLab' import Lab from '../../model/Lab' import Patient from '../../model/Patient' import Permissions from '../../model/Permissions' +import { RootState } from '../../store' -const mockStore = configureMockStore([thunk]) +const mockStore = createMockStore([thunk]) describe('Labs', () => { jest.spyOn(LabRepository, 'findAll').mockResolvedValue([]) @@ -41,7 +42,7 @@ describe('Labs', () => { patient: { id: 'patientId', fullName: 'some name' }, error: {}, }, - }) + } as any) const wrapper = mount( @@ -60,7 +61,7 @@ describe('Labs', () => { user: { permissions: [] }, breadcrumbs: { breadcrumbs: [] }, components: { sidebarCollapsed: false }, - }) + } as any) const wrapper = mount( @@ -90,7 +91,7 @@ describe('Labs', () => { patient: { id: 'patientId', fullName: 'some name' }, error: {}, }, - }) + } as any) let wrapper: any @@ -113,7 +114,7 @@ describe('Labs', () => { user: { permissions: [] }, breadcrumbs: { breadcrumbs: [] }, components: { sidebarCollapsed: false }, - }) + } as any) const wrapper = await mount( diff --git a/src/__tests__/labs/ViewLab.test.tsx b/src/__tests__/labs/ViewLab.test.tsx index e33508a26a..f7c0963aea 100644 --- a/src/__tests__/labs/ViewLab.test.tsx +++ b/src/__tests__/labs/ViewLab.test.tsx @@ -20,8 +20,9 @@ import Patient from '../../model/Patient' import Permissions from '../../model/Permissions' import * as ButtonBarProvider from '../../page-header/ButtonBarProvider' import * as titleUtil from '../../page-header/useTitle' +import { RootState } from '../../store' -const mockStore = createMockStore([thunk]) +const mockStore = createMockStore([thunk]) describe('View Labs', () => { let history: any @@ -63,7 +64,7 @@ describe('View Labs', () => { error, status: Object.keys(error).length > 0 ? 'error' : 'completed', }, - }) + } as any) let wrapper: any await act(async () => { diff --git a/src/__tests__/labs/ViewLabs.test.tsx b/src/__tests__/labs/ViewLabs.test.tsx index fc22385cea..2c3eae5a1b 100644 --- a/src/__tests__/labs/ViewLabs.test.tsx +++ b/src/__tests__/labs/ViewLabs.test.tsx @@ -8,7 +8,7 @@ import { createMemoryHistory } from 'history' import React from 'react' import { Provider } from 'react-redux' import { Router } from 'react-router-dom' -import configureMockStore from 'redux-mock-store' +import createMockStore from 'redux-mock-store' import thunk from 'redux-thunk' import LabRepository from '../../clients/db/LabRepository' @@ -18,8 +18,9 @@ import Lab from '../../model/Lab' import Permissions from '../../model/Permissions' import * as ButtonBarProvider from '../../page-header/ButtonBarProvider' import * as titleUtil from '../../page-header/useTitle' +import { RootState } from '../../store' -const mockStore = configureMockStore([thunk]) +const mockStore = createMockStore([thunk]) describe('View Labs', () => { describe('title', () => { @@ -29,7 +30,7 @@ describe('View Labs', () => { title: '', user: { permissions: [Permissions.ViewLabs, Permissions.RequestLab] }, labs: { labs: [] }, - }) + } as any) titleSpy = jest.spyOn(titleUtil, 'default') jest.spyOn(LabRepository, 'findAll').mockResolvedValue([]) await act(async () => { @@ -54,7 +55,7 @@ describe('View Labs', () => { title: '', user: { permissions: [Permissions.ViewLabs, Permissions.RequestLab] }, labs: { labs: [] }, - }) + } as any) const setButtonToolBarSpy = jest.fn() jest.spyOn(ButtonBarProvider, 'useButtonToolbarSetter').mockReturnValue(setButtonToolBarSpy) jest.spyOn(LabRepository, 'findAll').mockResolvedValue([]) @@ -77,7 +78,7 @@ describe('View Labs', () => { title: '', user: { permissions: [Permissions.ViewLabs] }, labs: { labs: [] }, - }) + } as any) const setButtonToolBarSpy = jest.fn() jest.spyOn(ButtonBarProvider, 'useButtonToolbarSetter').mockReturnValue(setButtonToolBarSpy) jest.spyOn(LabRepository, 'findAll').mockResolvedValue([]) @@ -113,7 +114,7 @@ describe('View Labs', () => { title: '', user: { permissions: [Permissions.ViewLabs, Permissions.RequestLab] }, labs: { labs: [expectedLab] }, - }) + } as any) history = createMemoryHistory() jest.spyOn(LabRepository, 'findAll').mockResolvedValue([expectedLab]) @@ -192,7 +193,7 @@ describe('View Labs', () => { title: '', user: { permissions: [Permissions.ViewLabs, Permissions.RequestLab] }, labs: { labs: [expectedLab] }, - }) + } as any) history = createMemoryHistory() await act(async () => { @@ -245,7 +246,7 @@ describe('View Labs', () => { title: '', user: { permissions: [Permissions.ViewLabs, Permissions.RequestLab] }, labs: { labs: [expectedLab] }, - }) + } as any) history = createMemoryHistory() jest.spyOn(LabRepository, 'findAll').mockResolvedValue([expectedLab]) diff --git a/src/__tests__/labs/requests/NewLabRequest.test.tsx b/src/__tests__/labs/requests/NewLabRequest.test.tsx index e496c57718..3270cf682c 100644 --- a/src/__tests__/labs/requests/NewLabRequest.test.tsx +++ b/src/__tests__/labs/requests/NewLabRequest.test.tsx @@ -7,7 +7,7 @@ import React from 'react' import { act } from 'react-dom/test-utils' import { Provider } from 'react-redux' import { Router } from 'react-router-dom' -import configureMockStore from 'redux-mock-store' +import createMockStore from 'redux-mock-store' import thunk from 'redux-thunk' import LabRepository from '../../../clients/db/LabRepository' @@ -18,8 +18,9 @@ import NewLabRequest from '../../../labs/requests/NewLabRequest' import Lab from '../../../model/Lab' import Patient from '../../../model/Patient' import * as titleUtil from '../../../page-header/useTitle' +import { RootState } from '../../../store' -const mockStore = configureMockStore([thunk]) +const mockStore = createMockStore([thunk]) describe('New Lab Request', () => { describe('title and breadcrumbs', () => { @@ -27,10 +28,7 @@ describe('New Lab Request', () => { const history = createMemoryHistory() beforeEach(() => { - const store = mockStore({ - title: '', - lab: { status: 'loading', error: {} }, - }) + const store = mockStore({ title: '', lab: { status: 'loading', error: {} } } as any) titleSpy = jest.spyOn(titleUtil, 'default') history.push('/labs/new') @@ -53,7 +51,7 @@ describe('New Lab Request', () => { const history = createMemoryHistory() beforeEach(() => { - const store = mockStore({ title: '', lab: { status: 'loading', error: {} } }) + const store = mockStore({ title: '', lab: { status: 'loading', error: {} } } as any) history.push('/labs/new') wrapper = mount( @@ -122,7 +120,7 @@ describe('New Lab Request', () => { beforeEach(() => { history.push('/labs/new') - const store = mockStore({ title: '', lab: { status: 'error', error } }) + const store = mockStore({ title: '', lab: { status: 'error', error } } as any) wrapper = mount( @@ -154,7 +152,7 @@ describe('New Lab Request', () => { beforeEach(() => { history.push('/labs/new') - const store = mockStore({ title: '', lab: { status: 'loading', error: {} } }) + const store = mockStore({ title: '', lab: { status: 'loading', error: {} } } as any) wrapper = mount( @@ -204,7 +202,7 @@ describe('New Lab Request', () => { title: '', lab: { status: 'loading', error: {} }, user: { user: { id: 'fake id' } }, - }) + } as any) wrapper = mount( diff --git a/src/__tests__/page-header/useTitle.test.tsx b/src/__tests__/page-header/useTitle.test.tsx index b77ad99778..1534ca2b58 100644 --- a/src/__tests__/page-header/useTitle.test.tsx +++ b/src/__tests__/page-header/useTitle.test.tsx @@ -1,17 +1,18 @@ import { renderHook } from '@testing-library/react-hooks' import React from 'react' import { Provider } from 'react-redux' -import configureMockStore from 'redux-mock-store' +import createMockStore from 'redux-mock-store' import thunk from 'redux-thunk' import * as titleSlice from '../../page-header/title-slice' import useTitle from '../../page-header/useTitle' +import { RootState } from '../../store' -const store = configureMockStore([thunk]) +const mockStore = createMockStore([thunk]) describe('useTitle', () => { it('should call the updateTitle with the correct data', () => { - const wrapper = ({ children }: any) => {children} + const wrapper = ({ children }: any) => {children} jest.spyOn(titleSlice, 'updateTitle') const expectedTitle = 'title' diff --git a/src/__tests__/patients/Patients.test.tsx b/src/__tests__/patients/Patients.test.tsx index 32c427904d..08e99e36fb 100644 --- a/src/__tests__/patients/Patients.test.tsx +++ b/src/__tests__/patients/Patients.test.tsx @@ -5,7 +5,7 @@ import React from 'react' import { act } from 'react-dom/test-utils' import { Provider } from 'react-redux' import { MemoryRouter } from 'react-router-dom' -import configureMockStore from 'redux-mock-store' +import createMockStore from 'redux-mock-store' import thunk from 'redux-thunk' import { addBreadcrumbs } from '../../breadcrumbs/breadcrumbs-slice' @@ -17,8 +17,9 @@ import Permissions from '../../model/Permissions' import EditPatient from '../../patients/edit/EditPatient' import NewPatient from '../../patients/new/NewPatient' import ViewPatient from '../../patients/view/ViewPatient' +import { RootState } from '../../store' -const mockStore = configureMockStore([thunk]) +const mockStore = createMockStore([thunk]) describe('/patients/new', () => { it('should render the new patient screen when /patients/new is accessed', async () => { @@ -28,7 +29,7 @@ describe('/patients/new', () => { patient: {}, breadcrumbs: { breadcrumbs: [] }, components: { sidebarCollapsed: false }, - }) + } as any) let wrapper: any @@ -61,7 +62,7 @@ describe('/patients/new', () => { user: { permissions: [] }, breadcrumbs: { breadcrumbs: [] }, components: { sidebarCollapsed: false }, - })} + } as any)} > @@ -92,7 +93,7 @@ describe('/patients/edit/:id', () => { patient: { patient }, breadcrumbs: { breadcrumbs: [] }, components: { sidebarCollapsed: false }, - }) + } as any) const wrapper = mount( @@ -122,7 +123,7 @@ describe('/patients/edit/:id', () => { user: { permissions: [Permissions.WritePatients] }, breadcrumbs: { breadcrumbs: [] }, components: { sidebarCollapsed: false }, - })} + } as any)} > @@ -141,7 +142,7 @@ describe('/patients/edit/:id', () => { user: { permissions: [Permissions.ReadPatients] }, breadcrumbs: { breadcrumbs: [] }, components: { sidebarCollapsed: false }, - })} + } as any)} > @@ -172,7 +173,7 @@ describe('/patients/:id', () => { patient: { patient }, breadcrumbs: { breadcrumbs: [] }, components: { sidebarCollapsed: false }, - }) + } as any) const wrapper = mount( @@ -201,7 +202,7 @@ describe('/patients/:id', () => { user: { permissions: [] }, breadcrumbs: { breadcrumbs: [] }, components: { sidebarCollapsed: false }, - })} + } as any)} > diff --git a/src/__tests__/patients/allergies/Allergies.test.tsx b/src/__tests__/patients/allergies/Allergies.test.tsx index 1fd0551b53..87ef0dd253 100644 --- a/src/__tests__/patients/allergies/Allergies.test.tsx +++ b/src/__tests__/patients/allergies/Allergies.test.tsx @@ -7,7 +7,7 @@ import { createMemoryHistory } from 'history' import React from 'react' import { Provider } from 'react-redux' import { Router } from 'react-router-dom' -import configureMockStore from 'redux-mock-store' +import createMockStore from 'redux-mock-store' import thunk from 'redux-thunk' import PatientRepository from '../../../clients/db/PatientRepository' @@ -15,8 +15,9 @@ import Allergy from '../../../model/Allergy' import Patient from '../../../model/Patient' import Permissions from '../../../model/Permissions' import Allergies from '../../../patients/allergies/Allergies' +import { RootState } from '../../../store' -const mockStore = configureMockStore([thunk]) +const mockStore = createMockStore([thunk]) const history = createMemoryHistory() const expectedPatient = { id: '123', @@ -32,7 +33,7 @@ let store: any const setup = (patient = expectedPatient, permissions = [Permissions.AddAllergy]) => { user = { permissions } - store = mockStore({ patient, user }) + store = mockStore({ patient, user } as any) const wrapper = mount( diff --git a/src/__tests__/patients/allergies/NewAllergyModal.test.tsx b/src/__tests__/patients/allergies/NewAllergyModal.test.tsx index 8bc22a8d97..6492bc0b8c 100644 --- a/src/__tests__/patients/allergies/NewAllergyModal.test.tsx +++ b/src/__tests__/patients/allergies/NewAllergyModal.test.tsx @@ -13,8 +13,9 @@ import TextInputWithLabelFormGroup from '../../../components/input/TextInputWith import Patient from '../../../model/Patient' import NewAllergyModal from '../../../patients/allergies/NewAllergyModal' import * as patientSlice from '../../../patients/patient-slice' +import { RootState } from '../../../store' -const mockStore = createMockStore([thunk]) +const mockStore = createMockStore([thunk]) describe('New Allergy Modal', () => { const mockPatient = { @@ -34,7 +35,7 @@ describe('New Allergy Modal', () => { id: '123', }, }, - }) + } as any) const wrapper = mount( @@ -63,7 +64,7 @@ describe('New Allergy Modal', () => { }, allergyError: expectedError, }, - }) + } as any) const wrapper = mount( @@ -89,7 +90,7 @@ describe('New Allergy Modal', () => { id: '123', }, }, - }) + } as any) const wrapper = mount( @@ -116,7 +117,7 @@ describe('New Allergy Modal', () => { patient: { patient, }, - }) + } as any) const wrapper = mount( diff --git a/src/__tests__/patients/appointments/AppointmentsList.test.tsx b/src/__tests__/patients/appointments/AppointmentsList.test.tsx index 70718f1fe6..0aca51515a 100644 --- a/src/__tests__/patients/appointments/AppointmentsList.test.tsx +++ b/src/__tests__/patients/appointments/AppointmentsList.test.tsx @@ -7,12 +7,13 @@ import React from 'react' import { act } from 'react-dom/test-utils' import { Provider } from 'react-redux' import { Router } from 'react-router-dom' -import configureMockStore from 'redux-mock-store' +import createMockStore from 'redux-mock-store' import thunk from 'redux-thunk' import Patient from '../../../model/Patient' import AppointmentsList from '../../../patients/appointments/AppointmentsList' import * as appointmentsSlice from '../../../scheduling/appointments/appointments-slice' +import { RootState } from '../../../store' const expectedPatient = { id: '123', @@ -39,13 +40,13 @@ const expectedAppointments = [ }, ] -const mockStore = configureMockStore([thunk]) +const mockStore = createMockStore([thunk]) const history = createMemoryHistory() let store: any const setup = (patient = expectedPatient, appointments = expectedAppointments) => { - store = mockStore({ patient, appointments: { appointments } }) + store = mockStore({ patient, appointments: { appointments } } as any) const wrapper = mount( diff --git a/src/__tests__/patients/diagnoses/AddDiagnosisModal.test.tsx b/src/__tests__/patients/diagnoses/AddDiagnosisModal.test.tsx index 82462f64f1..c31be04acd 100644 --- a/src/__tests__/patients/diagnoses/AddDiagnosisModal.test.tsx +++ b/src/__tests__/patients/diagnoses/AddDiagnosisModal.test.tsx @@ -15,8 +15,9 @@ import Diagnosis from '../../../model/Diagnosis' import Patient from '../../../model/Patient' import AddDiagnosisModal from '../../../patients/diagnoses/AddDiagnosisModal' import * as patientSlice from '../../../patients/patient-slice' +import { RootState } from '../../../store' -const mockStore = createMockStore([thunk]) +const mockStore = createMockStore([thunk]) describe('Add Diagnosis Modal', () => { beforeEach(() => { @@ -31,7 +32,7 @@ describe('Add Diagnosis Modal', () => { id: '1234', }, }, - }) + } as any) const wrapper = mount( @@ -58,7 +59,7 @@ describe('Add Diagnosis Modal', () => { patient: { diagnosisError: expectedDiagnosisError, }, - }) + } as any) const wrapper = mount( @@ -89,7 +90,7 @@ describe('Add Diagnosis Modal', () => { id: '1234', }, }, - }) + } as any) const wrapper = mount( @@ -129,7 +130,7 @@ describe('Add Diagnosis Modal', () => { patient: { patient, }, - }) + } as any) const wrapper = mount( diff --git a/src/__tests__/patients/diagnoses/Diagnoses.test.tsx b/src/__tests__/patients/diagnoses/Diagnoses.test.tsx index d172ebe607..f53e29c021 100644 --- a/src/__tests__/patients/diagnoses/Diagnoses.test.tsx +++ b/src/__tests__/patients/diagnoses/Diagnoses.test.tsx @@ -7,7 +7,7 @@ import React from 'react' import { act } from 'react-dom/test-utils' import { Provider } from 'react-redux' import { Router } from 'react-router-dom' -import configureMockStore from 'redux-mock-store' +import createMockStore from 'redux-mock-store' import thunk from 'redux-thunk' import PatientRepository from '../../../clients/db/PatientRepository' @@ -15,6 +15,7 @@ import Diagnosis from '../../../model/Diagnosis' import Patient from '../../../model/Patient' import Permissions from '../../../model/Permissions' import Diagnoses from '../../../patients/diagnoses/Diagnoses' +import { RootState } from '../../../store' const expectedPatient = { id: '123', @@ -23,7 +24,7 @@ const expectedPatient = { ], } as Patient -const mockStore = configureMockStore([thunk]) +const mockStore = createMockStore([thunk]) const history = createMemoryHistory() let user: any @@ -31,7 +32,7 @@ let store: any const setup = (patient = expectedPatient, permissions = [Permissions.AddDiagnosis]) => { user = { permissions } - store = mockStore({ patient, user }) + store = mockStore({ patient, user } as any) const wrapper = mount( diff --git a/src/__tests__/patients/edit/EditPatient.test.tsx b/src/__tests__/patients/edit/EditPatient.test.tsx index 9fc0a5a96f..01260ff4d1 100644 --- a/src/__tests__/patients/edit/EditPatient.test.tsx +++ b/src/__tests__/patients/edit/EditPatient.test.tsx @@ -8,7 +8,7 @@ import React from 'react' import { act } from 'react-dom/test-utils' import { Provider } from 'react-redux' import { Router, Route } from 'react-router-dom' -import configureMockStore, { MockStore } from 'redux-mock-store' +import createMockStore, { MockStore } from 'redux-mock-store' import thunk from 'redux-thunk' import PatientRepository from '../../../clients/db/PatientRepository' @@ -17,8 +17,9 @@ import * as titleUtil from '../../../page-header/useTitle' import EditPatient from '../../../patients/edit/EditPatient' import GeneralInformation from '../../../patients/GeneralInformation' import * as patientSlice from '../../../patients/patient-slice' +import { RootState } from '../../../store' -const mockStore = configureMockStore([thunk]) +const mockStore = createMockStore([thunk]) describe('Edit Patient', () => { const patient = { @@ -47,7 +48,7 @@ describe('Edit Patient', () => { jest.spyOn(PatientRepository, 'find').mockResolvedValue(patient) history = createMemoryHistory() - store = mockStore({ patient: { patient } }) + store = mockStore({ patient: { patient } } as any) history.push('/patients/edit/123') const wrapper = mount( diff --git a/src/__tests__/patients/labs/LabsTab.test.tsx b/src/__tests__/patients/labs/LabsTab.test.tsx index c053bda039..5a36aca1c9 100644 --- a/src/__tests__/patients/labs/LabsTab.test.tsx +++ b/src/__tests__/patients/labs/LabsTab.test.tsx @@ -1,5 +1,4 @@ import '../../../__mocks__/matchMediaMock' - import * as components from '@hospitalrun/components' import format from 'date-fns/format' import { mount } from 'enzyme' @@ -8,7 +7,7 @@ import React from 'react' import { act } from 'react-dom/test-utils' import { Provider } from 'react-redux' import { Router } from 'react-router-dom' -import configureMockStore from 'redux-mock-store' +import createMockStore from 'redux-mock-store' import thunk from 'redux-thunk' import LabRepository from '../../../clients/db/LabRepository' @@ -16,6 +15,7 @@ import Lab from '../../../model/Lab' import Patient from '../../../model/Patient' import Permissions from '../../../model/Permissions' import LabsTab from '../../../patients/labs/LabsTab' +import { RootState } from '../../../store' const expectedPatient = { id: '123', @@ -31,7 +31,7 @@ const labs = [ } as Lab, ] -const mockStore = configureMockStore([thunk]) +const mockStore = createMockStore([thunk]) const history = createMemoryHistory() let user: any @@ -39,7 +39,7 @@ let store: any const setup = (patient = expectedPatient, permissions = [Permissions.WritePatients]) => { user = { permissions } - store = mockStore({ patient, user }) + store = mockStore({ patient, user } as any) jest.spyOn(LabRepository, 'findAllByPatientId').mockResolvedValue(labs) const wrapper = mount( diff --git a/src/__tests__/patients/new/NewPatient.test.tsx b/src/__tests__/patients/new/NewPatient.test.tsx index 9d3e53b5a7..f5237c1091 100644 --- a/src/__tests__/patients/new/NewPatient.test.tsx +++ b/src/__tests__/patients/new/NewPatient.test.tsx @@ -7,7 +7,7 @@ import React from 'react' import { act } from 'react-dom/test-utils' import { Provider } from 'react-redux' import { Router, Route } from 'react-router-dom' -import configureMockStore, { MockStore } from 'redux-mock-store' +import createMockStore, { MockStore } from 'redux-mock-store' import thunk from 'redux-thunk' import { mocked } from 'ts-jest/utils' @@ -17,8 +17,9 @@ import * as titleUtil from '../../../page-header/useTitle' import GeneralInformation from '../../../patients/GeneralInformation' import NewPatient from '../../../patients/new/NewPatient' import * as patientSlice from '../../../patients/patient-slice' +import { RootState } from '../../../store' -const mockStore = configureMockStore([thunk]) +const mockStore = createMockStore([thunk]) describe('New Patient', () => { const patient = { @@ -35,7 +36,7 @@ describe('New Patient', () => { mockedPatientRepository.save.mockResolvedValue(patient) history = createMemoryHistory() - store = mockStore({ patient: { patient: {} as Patient, createError: error } }) + store = mockStore({ patient: { patient: {} as Patient, createError: error } } as any) history.push('/patients/new') const wrapper = mount( diff --git a/src/__tests__/patients/notes/NewNoteModal.test.tsx b/src/__tests__/patients/notes/NewNoteModal.test.tsx index 44becf6f9e..ba9a4abd7d 100644 --- a/src/__tests__/patients/notes/NewNoteModal.test.tsx +++ b/src/__tests__/patients/notes/NewNoteModal.test.tsx @@ -13,8 +13,9 @@ import TextFieldWithLabelFormGroup from '../../../components/input/TextFieldWith import Patient from '../../../model/Patient' import NewNoteModal from '../../../patients/notes/NewNoteModal' import * as patientSlice from '../../../patients/patient-slice' +import { RootState } from '../../../store' -const mockStore = createMockStore([thunk]) +const mockStore = createMockStore([thunk]) describe('New Note Modal', () => { beforeEach(() => { @@ -31,7 +32,7 @@ describe('New Note Modal', () => { patient: { patient: expectedPatient, }, - }) + } as any) const wrapper = mount( @@ -56,7 +57,7 @@ describe('New Note Modal', () => { patient: { patient: expectedPatient, }, - }) + } as any) const wrapper = mount( @@ -83,7 +84,7 @@ describe('New Note Modal', () => { patient: expectedPatient, noteError: expectedError, }, - }) + } as any) const wrapper = mount( @@ -109,7 +110,7 @@ describe('New Note Modal', () => { patient: { patient: expectedPatient, }, - }) + } as any) const wrapper = mount( @@ -138,7 +139,7 @@ describe('New Note Modal', () => { patient: { patient: expectedPatient, }, - }) + } as any) jest.spyOn(PatientRepository, 'find').mockResolvedValue(expectedPatient as Patient) jest.spyOn(PatientRepository, 'saveOrUpdate').mockResolvedValue(expectedPatient as Patient) diff --git a/src/__tests__/patients/notes/NotesTab.test.tsx b/src/__tests__/patients/notes/NotesTab.test.tsx index 6570eb08e6..b4191e03ae 100644 --- a/src/__tests__/patients/notes/NotesTab.test.tsx +++ b/src/__tests__/patients/notes/NotesTab.test.tsx @@ -7,7 +7,7 @@ import React from 'react' import { act } from 'react-dom/test-utils' import { Provider } from 'react-redux' import { Router } from 'react-router-dom' -import configureMockStore from 'redux-mock-store' +import createMockStore from 'redux-mock-store' import thunk from 'redux-thunk' import PatientRepository from '../../../clients/db/PatientRepository' @@ -15,13 +15,14 @@ import Note from '../../../model/Note' import Patient from '../../../model/Patient' import Permissions from '../../../model/Permissions' import NoteTab from '../../../patients/notes/NoteTab' +import { RootState } from '../../../store' const expectedPatient = { id: '123', notes: [{ date: new Date().toISOString(), text: 'notes1' } as Note], } as Patient -const mockStore = configureMockStore([thunk]) +const mockStore = createMockStore([thunk]) const history = createMemoryHistory() let user: any @@ -29,7 +30,7 @@ let store: any const setup = (patient = expectedPatient, permissions = [Permissions.WritePatients]) => { user = { permissions } - store = mockStore({ patient, user }) + store = mockStore({ patient, user } as any) const wrapper = mount( diff --git a/src/__tests__/patients/related-persons/AddRelatedPersonModal.test.tsx b/src/__tests__/patients/related-persons/AddRelatedPersonModal.test.tsx index 015a4055ef..37f65a319f 100644 --- a/src/__tests__/patients/related-persons/AddRelatedPersonModal.test.tsx +++ b/src/__tests__/patients/related-persons/AddRelatedPersonModal.test.tsx @@ -5,7 +5,7 @@ import { act } from '@testing-library/react' import { ReactWrapper, mount } from 'enzyme' import React from 'react' import { Provider } from 'react-redux' -import configureMockStore, { MockStore } from 'redux-mock-store' +import createMockStore, { MockStore } from 'redux-mock-store' import thunk from 'redux-thunk' import PatientRepository from '../../../clients/db/PatientRepository' @@ -13,8 +13,9 @@ import TextInputWithLabelFormGroup from '../../../components/input/TextInputWith import Patient from '../../../model/Patient' import * as patientSlice from '../../../patients/patient-slice' import AddRelatedPersonModal from '../../../patients/related-persons/AddRelatedPersonModal' +import { RootState } from '../../../store' -const mockStore = configureMockStore([thunk]) +const mockStore = createMockStore([thunk]) describe('Add Related Person Modal', () => { const patient = { @@ -41,7 +42,7 @@ describe('Add Related Person Modal', () => { store = mockStore({ patient: { patient }, - }) + } as any) beforeEach(() => { jest.spyOn(PatientRepository, 'find').mockResolvedValue(patient) jest.spyOn(PatientRepository, 'saveOrUpdate').mockResolvedValue(patient) @@ -102,7 +103,7 @@ describe('Add Related Person Modal', () => { patient, relatedPersonError: expectedError, }, - }) + } as any) wrapper = mount( @@ -128,7 +129,7 @@ describe('Add Related Person Modal', () => { patient: { patient, }, - }) + } as any) beforeEach(() => { wrapper = mount( diff --git a/src/__tests__/patients/related-persons/RelatedPersons.test.tsx b/src/__tests__/patients/related-persons/RelatedPersons.test.tsx index 5767ae5936..2beacd71b9 100644 --- a/src/__tests__/patients/related-persons/RelatedPersons.test.tsx +++ b/src/__tests__/patients/related-persons/RelatedPersons.test.tsx @@ -7,7 +7,7 @@ import { createMemoryHistory } from 'history' import React from 'react' import { Provider } from 'react-redux' import { Router } from 'react-router-dom' -import configureMockStore from 'redux-mock-store' +import createMockStore from 'redux-mock-store' import thunk from 'redux-thunk' import PatientRepository from '../../../clients/db/PatientRepository' @@ -17,8 +17,9 @@ import RelatedPerson from '../../../model/RelatedPerson' import * as patientSlice from '../../../patients/patient-slice' import AddRelatedPersonModal from '../../../patients/related-persons/AddRelatedPersonModal' import RelatedPersonTab from '../../../patients/related-persons/RelatedPersonTab' +import { RootState } from '../../../store' -const mockStore = configureMockStore([thunk]) +const mockStore = createMockStore([thunk]) describe('Related Persons Tab', () => { let wrapper: any @@ -47,7 +48,7 @@ describe('Related Persons Tab', () => { act(() => { wrapper = mount( - + , @@ -67,7 +68,7 @@ describe('Related Persons Tab', () => { act(() => { wrapper = mount( - + , @@ -123,7 +124,7 @@ describe('Related Persons Tab', () => { await act(async () => { wrapper = await mount( - + , @@ -203,7 +204,7 @@ describe('Related Persons Tab', () => { await act(async () => { wrapper = await mount( - + , diff --git a/src/__tests__/patients/view/ViewPatient.test.tsx b/src/__tests__/patients/view/ViewPatient.test.tsx index cb874e4317..71207f49bd 100644 --- a/src/__tests__/patients/view/ViewPatient.test.tsx +++ b/src/__tests__/patients/view/ViewPatient.test.tsx @@ -7,7 +7,7 @@ import React from 'react' import { act } from 'react-dom/test-utils' import { Provider } from 'react-redux' import { Route, Router } from 'react-router-dom' -import configureMockStore, { MockStore } from 'redux-mock-store' +import createMockStore, { MockStore } from 'redux-mock-store' import thunk from 'redux-thunk' import { mocked } from 'ts-jest/utils' @@ -25,8 +25,9 @@ import NotesTab from '../../../patients/notes/NoteTab' import * as patientSlice from '../../../patients/patient-slice' import RelatedPersonTab from '../../../patients/related-persons/RelatedPersonTab' import ViewPatient from '../../../patients/view/ViewPatient' +import { RootState } from '../../../store' -const mockStore = configureMockStore([thunk]) +const mockStore = createMockStore([thunk]) describe('ViewPatient', () => { const patient = { @@ -58,7 +59,7 @@ describe('ViewPatient', () => { store = mockStore({ patient: { patient }, user: { permissions }, - }) + } as any) history.push('/patients/123') const wrapper = mount( diff --git a/src/__tests__/scheduling/appointments/Appointments.test.tsx b/src/__tests__/scheduling/appointments/Appointments.test.tsx index a77cb50ea0..02d42fd37f 100644 --- a/src/__tests__/scheduling/appointments/Appointments.test.tsx +++ b/src/__tests__/scheduling/appointments/Appointments.test.tsx @@ -5,7 +5,7 @@ import React from 'react' import { act } from 'react-dom/test-utils' import { Provider } from 'react-redux' import { MemoryRouter } from 'react-router-dom' -import configureMockStore from 'redux-mock-store' +import createMockStore from 'redux-mock-store' import thunk from 'redux-thunk' import { addBreadcrumbs } from '../../../breadcrumbs/breadcrumbs-slice' @@ -19,8 +19,9 @@ import Permissions from '../../../model/Permissions' import EditAppointment from '../../../scheduling/appointments/edit/EditAppointment' import NewAppointment from '../../../scheduling/appointments/new/NewAppointment' import ViewAppointments from '../../../scheduling/appointments/ViewAppointments' +import { RootState } from '../../../store' -const mockStore = configureMockStore([thunk]) +const mockStore = createMockStore([thunk]) describe('/appointments', () => { it('should render the appointments screen when /appointments is accessed', async () => { @@ -30,7 +31,7 @@ describe('/appointments', () => { appointments: { appointments: [] }, breadcrumbs: { breadcrumbs: [] }, components: { sidebarCollapsed: false }, - }) + } as any) const wrapper = mount( @@ -62,7 +63,7 @@ describe('/appointments', () => { user: { permissions: [] }, breadcrumbs: { breadcrumbs: [] }, components: { sidebarCollapsed: false }, - })} + } as any)} > @@ -82,7 +83,7 @@ describe('/appointments/new', () => { appointment: {}, breadcrumbs: { breadcrumbs: [] }, components: { sidebarCollapsed: false }, - }) + } as any) const wrapper = mount( @@ -112,7 +113,7 @@ describe('/appointments/new', () => { user: { permissions: [] }, breadcrumbs: { breadcrumbs: [] }, components: { sidebarCollapsed: false }, - })} + } as any)} > @@ -144,7 +145,7 @@ describe('/appointments/edit/:id', () => { appointment: { appointment, patient: {} as Patient }, breadcrumbs: { breadcrumbs: [] }, components: { sidebarCollapsed: false }, - }) + } as any) const wrapper = mount( @@ -177,7 +178,7 @@ describe('/appointments/edit/:id', () => { user: { permissions: [Permissions.WriteAppointments] }, breadcrumbs: { breadcrumbs: [] }, components: { sidebarCollapsed: false }, - })} + } as any)} > @@ -196,7 +197,7 @@ describe('/appointments/edit/:id', () => { user: { permissions: [Permissions.ReadAppointments] }, breadcrumbs: { breadcrumbs: [] }, components: { sidebarCollapsed: false }, - })} + } as any)} > diff --git a/src/__tests__/scheduling/appointments/ViewAppointments.test.tsx b/src/__tests__/scheduling/appointments/ViewAppointments.test.tsx index a47418d7c9..57c1bbc1eb 100644 --- a/src/__tests__/scheduling/appointments/ViewAppointments.test.tsx +++ b/src/__tests__/scheduling/appointments/ViewAppointments.test.tsx @@ -6,7 +6,7 @@ import { mount } from 'enzyme' import React from 'react' import { Provider } from 'react-redux' import { MemoryRouter } from 'react-router-dom' -import configureMockStore from 'redux-mock-store' +import createMockStore from 'redux-mock-store' import thunk from 'redux-thunk' import { mocked } from 'ts-jest/utils' @@ -17,6 +17,7 @@ import Patient from '../../../model/Patient' import * as ButtonBarProvider from '../../../page-header/ButtonBarProvider' import * as titleUtil from '../../../page-header/useTitle' import ViewAppointments from '../../../scheduling/appointments/ViewAppointments' +import { RootState } from '../../../store' describe('ViewAppointments', () => { const expectedAppointments = [ @@ -39,9 +40,9 @@ describe('ViewAppointments', () => { id: '123', fullName: 'patient full name', } as Patient) - const mockStore = configureMockStore([thunk]) + const mockStore = createMockStore([thunk]) return mount( - + diff --git a/src/__tests__/scheduling/appointments/edit/EditAppointment.test.tsx b/src/__tests__/scheduling/appointments/edit/EditAppointment.test.tsx index 0c85659751..c8a006b06f 100644 --- a/src/__tests__/scheduling/appointments/edit/EditAppointment.test.tsx +++ b/src/__tests__/scheduling/appointments/edit/EditAppointment.test.tsx @@ -8,7 +8,7 @@ import React from 'react' import { act } from 'react-dom/test-utils' import { Provider } from 'react-redux' import { Router, Route } from 'react-router-dom' -import configureMockStore, { MockStore } from 'redux-mock-store' +import createMockStore, { MockStore } from 'redux-mock-store' import thunk from 'redux-thunk' import { mocked } from 'ts-jest/utils' @@ -20,8 +20,9 @@ import * as titleUtil from '../../../../page-header/useTitle' import * as appointmentSlice from '../../../../scheduling/appointments/appointment-slice' import AppointmentDetailForm from '../../../../scheduling/appointments/AppointmentDetailForm' import EditAppointment from '../../../../scheduling/appointments/edit/EditAppointment' +import { RootState } from '../../../../store' -const mockStore = configureMockStore([thunk]) +const mockStore = createMockStore([thunk]) describe('Edit Appointment', () => { const appointment = { @@ -68,7 +69,7 @@ describe('Edit Appointment', () => { mockedPatientRepository.find.mockResolvedValue(patient) history = createMemoryHistory() - store = mockStore({ appointment: { appointment, patient } }) + store = mockStore({ appointment: { appointment, patient } } as any) history.push('/appointments/edit/123') const wrapper = mount( diff --git a/src/__tests__/scheduling/appointments/new/NewAppointment.test.tsx b/src/__tests__/scheduling/appointments/new/NewAppointment.test.tsx index f4f4139126..6da7e26ec1 100644 --- a/src/__tests__/scheduling/appointments/new/NewAppointment.test.tsx +++ b/src/__tests__/scheduling/appointments/new/NewAppointment.test.tsx @@ -8,7 +8,7 @@ import { createMemoryHistory, MemoryHistory } from 'history' import React from 'react' import { Provider } from 'react-redux' import { Router, Route } from 'react-router-dom' -import configureMockStore, { MockStore } from 'redux-mock-store' +import createMockStore, { MockStore } from 'redux-mock-store' import thunk from 'redux-thunk' import { mocked } from 'ts-jest/utils' @@ -21,8 +21,9 @@ import * as titleUtil from '../../../../page-header/useTitle' import * as appointmentSlice from '../../../../scheduling/appointments/appointment-slice' import AppointmentDetailForm from '../../../../scheduling/appointments/AppointmentDetailForm' import NewAppointment from '../../../../scheduling/appointments/new/NewAppointment' +import { RootState } from '../../../../store' -const mockStore = configureMockStore([thunk]) +const mockStore = createMockStore([thunk]) const mockedComponents = mocked(components, true) describe('New Appointment', () => { @@ -43,7 +44,7 @@ describe('New Appointment', () => { appointment: {} as Appointment, patient: {} as Patient, }, - }) + } as any) history.push('/appointments/new') const wrapper = mount( diff --git a/src/__tests__/scheduling/appointments/view/ViewAppointment.test.tsx b/src/__tests__/scheduling/appointments/view/ViewAppointment.test.tsx index e3934501c1..15de39ed57 100644 --- a/src/__tests__/scheduling/appointments/view/ViewAppointment.test.tsx +++ b/src/__tests__/scheduling/appointments/view/ViewAppointment.test.tsx @@ -7,7 +7,7 @@ import React from 'react' import { act } from 'react-dom/test-utils' import { Provider } from 'react-redux' import { Router, Route } from 'react-router-dom' -import configureMockStore, { MockStore } from 'redux-mock-store' +import createMockStore, { MockStore } from 'redux-mock-store' import thunk from 'redux-thunk' import { mocked } from 'ts-jest/utils' @@ -21,8 +21,9 @@ import * as titleUtil from '../../../../page-header/useTitle' import * as appointmentSlice from '../../../../scheduling/appointments/appointment-slice' import AppointmentDetailForm from '../../../../scheduling/appointments/AppointmentDetailForm' import ViewAppointment from '../../../../scheduling/appointments/view/ViewAppointment' +import { RootState } from '../../../../store' -const mockStore = configureMockStore([thunk]) +const mockStore = createMockStore([thunk]) const appointment = { id: '123', @@ -64,7 +65,7 @@ describe('View Appointment', () => { status, patient, }, - }) + } as any) const wrapper = mount(