Answers for "shallow render in react"

0

shallow render in react

import ShallowRenderer from 'react-test-renderer/shallow';

// in your test:
const renderer = new ShallowRenderer();
renderer.render(<MyComponent />);
const result = renderer.getRenderOutput();

expect(result.type).toBe('div');
expect(result.props.children).toEqual([
  <span className="heading">Title</span>,
  <Subcomponent foo="bar" />
]);
Posted by: Guest on December-23-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language