shallow render in react

Solutions on MaxInterview for shallow render in react by the best coders in the world

showing results for - "shallow render in react"
Fawn
03 May 2016
1import ShallowRenderer from 'react-test-renderer/shallow';
2
3// in your test:
4const renderer = new ShallowRenderer();
5renderer.render(<MyComponent />);
6const result = renderer.getRenderOutput();
7
8expect(result.type).toBe('div');
9expect(result.props.children).toEqual([
10  <span className="heading">Title</span>,
11  <Subcomponent foo="bar" />
12]);