Let's say I have a React element:
<p>
<span class="first-part">
foo
</span>
<span class="second-part">
bar
</span>
</p>
Using Enzyme, how do I test if the element contains a specific piece of text?
You should find the entire text and determine if it contains the text using vanilla JavaScript, then test if your discovery is true
or not via Enzyme:
it('should show correct text', () => {
const wrapper = shallow(<div />);
expect(wrapper.text().includes('foo')).toBe(true);
});