diff --git a/src/__tests__/patients/notes/ViewNote.test.tsx b/src/__tests__/patients/notes/ViewNote.test.tsx
index 74172470c7..fe164a776a 100644
--- a/src/__tests__/patients/notes/ViewNote.test.tsx
+++ b/src/__tests__/patients/notes/ViewNote.test.tsx
@@ -1,11 +1,9 @@
-import { mount, ReactWrapper } from 'enzyme'
+import { render, screen } from '@testing-library/react'
import { createMemoryHistory } from 'history'
import React from 'react'
-import { act } from 'react-dom/test-utils'
import { Route, Router } from 'react-router-dom'
import ViewNote from '../../../patients/notes/ViewNote'
-import TextInputWithLabelFormGroup from '../../../shared/components/input/TextInputWithLabelFormGroup'
import PatientRepository from '../../../shared/db/PatientRepository'
import Patient from '../../../shared/model/Patient'
@@ -15,32 +13,21 @@ describe('View Note', () => {
notes: [{ id: '123', text: 'some name', date: '1947-09-09T14:48:00.000Z' }],
} as Patient
- const setup = async () => {
+ it('should render a note input with the correct data', async () => {
jest.spyOn(PatientRepository, 'find').mockResolvedValue(patient)
- const history = createMemoryHistory()
- history.push(`/patients/${patient.id}/notes/${patient.notes![0].id}`)
- let wrapper: any
-
- await act(async () => {
- wrapper = await mount(
-
-
-
-
- ,
- )
+ const history = createMemoryHistory({
+ initialEntries: [`/patients/${patient.id}/notes/${patient.notes![0].id}`],
})
- wrapper.update()
-
- return { wrapper: wrapper as ReactWrapper }
- }
-
- it('should render a note input with the correct data', async () => {
- const { wrapper } = await setup()
+ render(
+
+
+
+
+ ,
+ )
- const noteText = wrapper.find(TextInputWithLabelFormGroup)
- expect(noteText).toHaveLength(1)
- expect(noteText.prop('value')).toEqual(patient.notes![0].text)
+ const input = await screen.findByLabelText(/patient.note/i)
+ expect(input).toHaveValue(patient.notes![0].text)
})
})