I have a unit test that uses that contains function which works. Is it possible to select an node from a collection and then take the text property? I tried this:
it('should be equaling name property', () => {
const props = {
myprops: [{
email: "blaat@mail.com",
name: "Coco Chanel"
}]
};
const wrapper = shallow(<ServiceDetails {...props} />);
expect(wrapper.find('div')[0].text).equals('Cici Chanel');
});
This is part of my reactjs component:
return (
<section>
<div>{email}</div>
<div>{name}</div>
</section>
)
However I am getting this error:
TypeError: Cannot read property 'text' of undefined
How can I select the second div and take the value that is in that div?