Add unit test to onlyChild to ensure onlyChild returns child element (#8667)

Add unit test to onlyChild to ensure onlyChild returns child element
This commit is contained in:
Eric Churchill
2017-01-14 14:09:24 -08:00
committed by Brian Vaughn
parent ebd83e809e
commit cd4afca043

View File

@@ -83,15 +83,12 @@ describe('onlyChild', () => {
}).not.toThrow();
});
it('should return the only child', () => {
expect(function() {
var instance =
<WrapComponent>
<span />
</WrapComponent>;
onlyChild(instance.props.children);
}).not.toThrow();
var instance =
<WrapComponent>
<span />
</WrapComponent>;
expect(onlyChild(instance.props.children)).toEqual(<span />);
});
});