So say i have this table:
<table>
<thead>
<tr>
<th>cat name</th>
</tr>
</thead>
<tbody>
{cats.map(cat => {
return (
<tr key={cat.id}>
<td styleName="table-item">{ cat.name }</td>
</tr>
);
})}
</tbody>
</table>
How do i go about testing the jsx inside the map function with enzyme?
I am able to test the other parts of it fine, like so:
describe('<CatsTable />', () => {
const wrapper = mount(
<CatsTable cats={cats} />
);
it('renders correctly', () => {
expect(wrapper.find('table')).to.have.length(1);
expect(wrapper.find('tbody')).to.have.length(1);
});
});
But if i try the same thing with what's inside the map function it returns undefined