How can I invoke a method on my component?

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

expect(app.instance().getList()).toBe([0, 1, 2])

Last updated

Was this helpful?