From 87c0d0d2ca826174880da5e7272d7a860f2d853d Mon Sep 17 00:00:00 2001 From: Juhana Jauhiainen Date: Wed, 30 Dec 2020 21:16:30 +0200 Subject: [PATCH] Removed function call assertations --- .../patients/visits/VisitForm.test.tsx | 26 ++++--------------- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/src/__tests__/patients/visits/VisitForm.test.tsx b/src/__tests__/patients/visits/VisitForm.test.tsx index 9a399b05f2..eb7e168cfe 100644 --- a/src/__tests__/patients/visits/VisitForm.test.tsx +++ b/src/__tests__/patients/visits/VisitForm.test.tsx @@ -58,13 +58,11 @@ describe('Visit Form', () => { const startDateTimePicker = container.querySelectorAll( '.react-datepicker__input-container input', )[0] - fireEvent.change(startDateTimePicker, { - target: { value: format(expectedNewStartDateTime, 'MM/dd/yyyy h:mm aa') }, - }) + userEvent.type( + startDateTimePicker, + `{selectall}${format(expectedNewStartDateTime, 'MM/dd/yyyy h:mm aa')}`, + ) - expect(onVisitChangeSpy).toHaveBeenCalledWith({ - startDateTime: expectedNewStartDateTime.toISOString(), - }) expect(startDateTimePicker).toHaveDisplayValue( format(expectedNewStartDateTime, 'MM/dd/yyyy h:mm aa'), ) @@ -98,16 +96,6 @@ describe('Visit Form', () => { endDateTimePicker, `{selectall}${format(expectedNewEndDateTime, 'MM/dd/yyyy h:mm aa')}`, ) - expect(endDateTimePicker).toHaveDisplayValue([ - format(new Date(expectedNewEndDateTime), 'MM/dd/yyyy h:mm aa'), - ]) - fireEvent.change(endDateTimePicker, { - target: { value: format(expectedNewEndDateTime, 'MM/dd/yyyy h:mm aa') }, - }) - - expect(onVisitChangeSpy).toHaveBeenCalledWith({ - endDateTime: expectedNewEndDateTime.toISOString(), - }) expect(endDateTimePicker).toHaveDisplayValue([ format(expectedNewEndDateTime, 'MM/dd/yyyy h:mm aa'), ]) @@ -131,8 +119,6 @@ describe('Visit Form', () => { userEvent.type(typeInput, expectedNewType) expect(typeInput).toHaveDisplayValue(expectedNewType) - - expect(onVisitChangeSpy).toHaveBeenCalledWith({ type: expectedNewType }) }) it('should render a status selector', () => { @@ -163,7 +149,6 @@ describe('Visit Form', () => { await selectEvent.select(statusSelector, expectedNewStatus) expect(statusSelector).toHaveDisplayValue(expectedNewStatus) - expect(onVisitChangeSpy).toHaveBeenCalledWith({ status: expectedNewStatus }) }) it('should render a reason input', () => { @@ -185,7 +170,7 @@ describe('Visit Form', () => { const reasonInput = screen.getAllByRole('textbox', { hidden: false })[3] - userEvent.paste(reasonInput, expectedNewReason) + fireEvent.change(reasonInput, { target: { value: expectedNewReason } }) expect(onVisitChangeSpy).toHaveBeenCalledWith({ reason: expectedNewReason }) // expect(reasonInput).toHaveDisplayValue(expectedNewReason) @@ -212,7 +197,6 @@ describe('Visit Form', () => { userEvent.type(locationInput, expectedNewLocation) expect(locationInput).toHaveDisplayValue(expectedNewLocation) - expect(onVisitChangeSpy).toHaveBeenCalledWith({ location: expectedNewLocation }) }) it('should render all of the fields as disabled if the form is disabled', async () => {