Add unit test to onlyChild to ensure onlyChild returns child element (#8667)
Add unit test to onlyChild to ensure onlyChild returns child element
Eric Churchill committed
Jan 14, 2017 at 14:09 UTC
cd4afca0434b17d7fad097bddb2eed0ef89b580a
1 file changed
+5
-8
src/isomorphic/children/__tests__/onlyChild-test.js
+5
-8
@@ -83,15 +83,12 @@ describe('onlyChild', () => {
83
}).not.toThrow();
84
});
85
86
-
86
it('should return the only child', () => {
88
- expect(function() {
89
- var instance =
90
- <WrapComponent>
91
- <span />
92
- </WrapComponent>;
93
- onlyChild(instance.props.children);
94
- }).not.toThrow();
87
+ var instance =
88
+ <WrapComponent>
89
+ <span />
90
+ </WrapComponent>;
91
+ expect(onlyChild(instance.props.children)).toEqual(<span />);
92
});
93
94
});