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

Commit

Permalink
test(viewmedication.test.tsx): update cancelled on test to RTL
Browse files Browse the repository at this point in the history
  • Loading branch information
emma-r-slight committed Dec 24, 2020
1 parent 5b5708b commit af01021
Showing 1 changed file with 19 additions and 23 deletions.
42 changes: 19 additions & 23 deletions src/__tests__/medications/ViewMedication.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -242,30 +242,26 @@ describe('View Medication', () => {
})
})
})
/*
describe.skip('on cancel', () => {

describe('on cancel', () => {
it('should mark the status as canceled and fill in the cancelled on date with the current time', async () => {
const { wrapper, expectedMedication, medicationRepositorySaveSpy, history } = await setup(
{},
[Permissions.ViewMedication, Permissions.CompleteMedication, Permissions.CancelMedication],
)
const cancelButton = wrapper.find(Button).at(1)
await act(async () => {
const onClick = cancelButton.prop('onClick')
await onClick()
})
wrapper.update()
const expectedMedication = { ...mockMedication } as Medication
setup(expectedMedication, [
Permissions.ViewMedication,
Permissions.CompleteMedication,
Permissions.CancelMedication,
])

expect(medicationRepositorySaveSpy).toHaveBeenCalled()
expect(medicationRepositorySaveSpy).toHaveBeenCalledWith(
expect.objectContaining({
...expectedMedication,
status: 'canceled',
canceledOn: expectedDate.toISOString(),
}),
)
expect(history.location.pathname).toEqual('/medications')
const cancelButton = screen.getByRole('button', { name: /medications\.requests\.cancel/ })

userEvent.click(cancelButton)

expect(MedicationRepository.saveOrUpdate).toHaveBeenCalled()
expect(MedicationRepository.saveOrUpdate).toHaveBeenCalledWith({
...expectedMedication,
status: 'canceled',
canceledOn: expectedDate.toISOString(),
})
})
}) */
})
})

0 comments on commit af01021

Please sign in to comment.