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

Commit

Permalink
fix(searchpatients.test): add "await" to async tests
Browse files Browse the repository at this point in the history
fixes #168
  • Loading branch information
emma-r-slight committed Dec 31, 2020
1 parent 0a9570f commit 8159479
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/__tests__/patients/search/SearchPatients.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ describe('Search Patients', () => {

await waitFor(() => {
expect(screen.getByRole('heading', { name: /patients\.nopatients/i })).toBeInTheDocument()
})
await waitFor(() => {
expect(screen.getByRole('button', { name: /patients\.newpatient/i })).toBeInTheDocument()
})
})
Expand All @@ -55,18 +57,33 @@ describe('Search Patients', () => {

await waitFor(() => {
expect(screen.getByRole('heading', { name: /patients\.nopatients/i })).toBeInTheDocument()
})

await waitFor(() => {
expect(screen.getByRole('button', { name: /patients\.newpatient/i })).toBeInTheDocument()
})

const patientSearch = screen.getByPlaceholderText(/actions\.search/i)
userEvent.type(patientSearch, expectedSearch)
expect(patientSearch).toHaveDisplayValue(expectedSearch)

await waitFor(() => {
expect(patientSearch).toHaveDisplayValue(expectedSearch)
})

await waitFor(() => {
expect(screen.getByRole('cell', { name: expectedPatient.code })).toBeInTheDocument()
})

await waitFor(() => {
expect(screen.getByRole('cell', { name: expectedPatient.givenName })).toBeInTheDocument()
})
await waitFor(() => {
expect(screen.getByRole('cell', { name: expectedPatient.familyName })).toBeInTheDocument()
})
await waitFor(() => {
expect(screen.getByRole('cell', { name: expectedPatient.sex })).toBeInTheDocument()
})
await waitFor(() => {
expect(
screen.getByRole('cell', { name: format(dateOfBirth, 'MM/dd/yyyy') }),
).toBeInTheDocument()
Expand Down

0 comments on commit 8159479

Please sign in to comment.