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

Commit

Permalink
Remove function call assertations
Browse files Browse the repository at this point in the history
  • Loading branch information
juhanakristian committed Dec 29, 2020
1 parent 6263c9a commit cac69a3
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions src/__tests__/patients/search/SearchPatients.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,23 +53,25 @@ describe('Search Patients', () => {
const expectedSearch = 'someQueryString'
render(<SearchPatients />)

await waitFor(() => {
expect(screen.getByRole('heading', { name: /patients\.nopatients/i })).toBeInTheDocument()
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(searchSpyOn).toHaveBeenCalledTimes(2)
expect(searchSpyOn).toHaveBeenCalledWith(expectedSearch)
expect(screen.getByRole('cell', { name: expectedPatient.code })).toBeInTheDocument()
expect(screen.getByRole('cell', { name: expectedPatient.givenName })).toBeInTheDocument()
expect(screen.getByRole('cell', { name: expectedPatient.familyName })).toBeInTheDocument()
expect(screen.getByRole('cell', { name: expectedPatient.sex })).toBeInTheDocument()
expect(
screen.getByRole('cell', { name: format(dateOfBirth, 'MM/dd/yyyy') }),
).toBeInTheDocument()
})

expect(screen.getByRole('cell', { name: expectedPatient.code })).toBeInTheDocument()
expect(screen.getByRole('cell', { name: expectedPatient.givenName })).toBeInTheDocument()
expect(screen.getByRole('cell', { name: expectedPatient.familyName })).toBeInTheDocument()
expect(screen.getByRole('cell', { name: expectedPatient.sex })).toBeInTheDocument()
expect(
screen.getByRole('cell', { name: format(dateOfBirth, 'MM/dd/yyyy') }),
).toBeInTheDocument()

searchSpyOn.mockReset()
searchSpyOn.mockRestore()

Expand Down

0 comments on commit cac69a3

Please sign in to comment.