|
| 1 | +import { shallow } from 'enzyme'; |
| 2 | +import * as React from 'react'; |
| 3 | + |
| 4 | +import getRenderOrChildren from './getRenderOrChildren'; |
| 5 | + |
| 6 | +describe('with children node and render function', () => { |
| 7 | + const children = <div>result</div>; |
| 8 | + const render = () => <div>result</div>; |
| 9 | + const result = '<div>result</div>'; |
| 10 | + |
| 11 | + test('should return content from children', () => { |
| 12 | + const wrapper = shallow(getRenderOrChildren(children, render)); |
| 13 | + expect(wrapper.html()).toEqual(result); |
| 14 | + }); |
| 15 | + |
| 16 | + test('should return content from render', () => { |
| 17 | + const wrapper = shallow(getRenderOrChildren(undefined, render)); |
| 18 | + expect(wrapper.html()).toEqual(result); |
| 19 | + }); |
| 20 | +}); |
| 21 | + |
| 22 | +describe('with children function and render function', () => { |
| 23 | + const children = () => <div>result</div>; |
| 24 | + const render = () => <div>result</div>; |
| 25 | + const result = '<div>result</div>'; |
| 26 | + |
| 27 | + test('should return content from children', () => { |
| 28 | + const wrapper = shallow(getRenderOrChildren(children, render)); |
| 29 | + expect(wrapper.html()).toEqual(result); |
| 30 | + }); |
| 31 | + |
| 32 | + test('should return content from render', () => { |
| 33 | + const wrapper = shallow(getRenderOrChildren(undefined, render)); |
| 34 | + expect(wrapper.html()).toEqual(result); |
| 35 | + }); |
| 36 | +}); |
0 commit comments