Quantcast
Channel: Testing React component with Enzyme Jest finding HTML element - Stack Overflow
Viewing all articles
Browse latest Browse all 3

Answer by Full-Hybrid for Testing React component with Enzyme Jest finding HTML element

$
0
0

So it looks like my assertions, using Enzyme, on expect are not setup. Upon reading the Enzyme docs further my setup is only using the Adapter allowing for easier rendering/mounting of components. I do not have the ability to use the Enzyme assertions from the docs because they are not installed. Rather to answer this particular problem I have to use the Jest assertions.

describe('<Typography />', () => {
  it('renders h1', () => {
    const wrapper = mount(<Typography variant="h1" />);
    const elem = wrapper.find('h1');
    expect(elem.length).toBe(1);
  });
});

https://jestjs.io/docs/en/expect


Viewing all articles
Browse latest Browse all 3

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>