Istvan Orban
Istvan Orban

Reputation: 1695

How to test React Native Button's simulate?

I trying to test some components, and I would like to spy after an onPress but for some reason its not being called:

it('expect press', () => {
    const listItem = wrapper.find('ListItem')
    listItem.simulate('onPress')
    console.log(mockFn.mock)
})

When I debugging the component, I can clearly see that I selected the right element, but yet the simulate do not happen :/

Upvotes: 0

Views: 960

Answers (1)

Moyote
Moyote

Reputation: 1217

Change it to

listItem.simulate('Press')

Upvotes: 2

Related Questions