I\'m testing a React component with Jasmine Enzyme shallow rendering.
Simplified here for the purposes of this question...
function MyOuterComponent() {
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')
})
const component = wrapper.find('MyInnerComponent').at(1);
//at(1) index of element 0 to ~
expect(component.prop('title')).to.equal('Good-bye');
What you want is the .at(index)
method: .at(index) .
So, for your example:
expect(component.find('MyInnerComponent').at(1)).toHaveProp('title', 'Good-bye');