React Enzyme find second (or nth) node
Solution 1:
What you want is the .at(index)
method: .at(index) .
So, for your example:
expect(component.find('MyInnerComponent').at(1)).toHaveProp('title', 'Good-bye');
Solution 2:
If you are to test certain things on each one also consider iterating through the matched set:
component.find('MyInnerComponent').forEach( (node) => {
expect(node.prop('title')).toEqual('Good-bye')
})
Solution 3:
const component = wrapper.find('MyInnerComponent').at(1);
//at(1) index of element 0 to ~
expect(component.prop('title')).to.equal('Good-bye');