From cac69a33040d6c69f8ccc6599afa170f94c4e712 Mon Sep 17 00:00:00 2001 From: Juhana Jauhiainen Date: Tue, 29 Dec 2020 18:01:34 +0200 Subject: [PATCH] Remove function call assertations --- .../patients/search/SearchPatients.test.tsx | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/__tests__/patients/search/SearchPatients.test.tsx b/src/__tests__/patients/search/SearchPatients.test.tsx index b06c639166..e474ab0755 100644 --- a/src/__tests__/patients/search/SearchPatients.test.tsx +++ b/src/__tests__/patients/search/SearchPatients.test.tsx @@ -53,23 +53,25 @@ describe('Search Patients', () => { const expectedSearch = 'someQueryString' render() + 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()