> For the complete documentation index, see [llms.txt](https://asad-razvi.gitbook.io/jest-enzyme-recipes/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://asad-razvi.gitbook.io/jest-enzyme-recipes/enzyme/how-can-i-check-to-see-if-an-event-handler-was-invoked.md).

# How can I check to see if an event handler was invoked?

```javascript
import { shallow } from 'enzyme'
const props = { onClick: jest.fn() }
const wrapper = <App {...props} />
const domNode = document.querySelector('#root')
const component = shallow(wrapper, domNode)

const id = 0
const selector = '.btn-remove'
const eventName = 'click'
component.find(selector).simulate(eventName)
expect(props.onClick).toHaveBeenCalledWith(id)
```
