Enzyme shallow test on custom component

Viewed 13

I have this test:

it('renders', () => {
wrapper = shallow(<CustomComponent {...props} />);
    expect(wrapper.length).toBeGreaterThan(0);
    expect(wrapper.text()).toContain('Text example');
});

I had to change on the code the string 'Text example' with a custom component:

<Custom resourceKey='Text example'/>

so now the second expect won't work, I don't have much experience with enzyme testing, I would check the text ignoring the Custom tag and that's where I got lost, I tried many different properties, but still can't find the correct one.

The closets I got was this:

expect(wrapper.children().text()).toContain('Text example');

But still not working.

Can anyone help? Thanks

0 Answers
Related