<p dir="auto">I'm using react 14.3, babel 6.0.15 and react test utils addon 0.14.6 . Jasmine 2.3 is my testing framework of choice.</p>
<p dir="auto">It seems as though any stateless function component cannot be tested by TestUtils.renderIntoComponent or TestUtils.createRenderer().render(). Either returns null when rendering the function component.</p>
<p dir="auto">Test with any stateless function component and it should yield the same result.</p>
<h2 dir="auto">Component:</h2>
<p dir="auto"><code class="notranslate">import React from 'react';</code></p>
<p dir="auto"><code class="notranslate">const User = ({name, age}) =&gt; ( return &lt;div&gt;{name}, {age}&lt;/div&gt; );</code></p>
<p dir="auto"><code class="notranslate">module.exports = User;</code></p>
<h2 dir="auto">Test:</h2>
<p dir="auto"><code class="notranslate">expect(TestUtils.renderIntoDocument(&lt;User name={"bob"} age={20} /&gt;)).toBeTruthy();</code></p>
<h2 dir="auto">Error:</h2>
<p dir="auto">Expected null to be truthy.</p>
<p dir="auto">In <a href="https://github.com/facebook/react/blob/master/src/shared/utils/PooledClass.js#L18">PooledClass.js</a> we have some static poolers based on the number of arguments &amp; the comment specifies <code class="notranslate">it's not made dynamic so we don't have to use arguments.</code></p>
<p dir="auto">I have 2 questions with this:</p>
<ol dir="auto">
<li>What is the issue with using arguments (i noticed we're using it in other place <a href="https://github.com/facebook/react/blob/master/docs/js/react-dom.js#L8444">reference</a>) if it's going to reduce duplicate code ?</li>
<li>Can't we use the spread syntax for this like this:</li>
</ol>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="function nArgumentPooler(...args) {
    var Klass = this;
    if (Klass.instancePool.length) {
        var instance = Klass.instancePool.pop();
        Klass.call(instance, args);
    	return instance;
    } else {
        return new Klass(args);
    }
}"><pre class="notranslate"><span class="pl-k">function</span> <span class="pl-en">nArgumentPooler</span><span class="pl-kos">(</span>...<span class="pl-s1">args</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
    <span class="pl-k">var</span> <span class="pl-v">Klass</span> <span class="pl-c1">=</span> <span class="pl-smi">this</span><span class="pl-kos">;</span>
    <span class="pl-k">if</span> <span class="pl-kos">(</span><span class="pl-v">Klass</span><span class="pl-kos">.</span><span class="pl-c1">instancePool</span><span class="pl-kos">.</span><span class="pl-c1">length</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
        <span class="pl-k">var</span> <span class="pl-s1">instance</span> <span class="pl-c1">=</span> <span class="pl-v">Klass</span><span class="pl-kos">.</span><span class="pl-c1">instancePool</span><span class="pl-kos">.</span><span class="pl-en">pop</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
        <span class="pl-v">Klass</span><span class="pl-kos">.</span><span class="pl-en">call</span><span class="pl-kos">(</span><span class="pl-s1">instance</span><span class="pl-kos">,</span> <span class="pl-s1">args</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
    	<span class="pl-k">return</span> <span class="pl-s1">instance</span><span class="pl-kos">;</span>
    <span class="pl-kos">}</span> <span class="pl-k">else</span> <span class="pl-kos">{</span>
        <span class="pl-k">return</span> <span class="pl-k">new</span> <span class="pl-v">Klass</span><span class="pl-kos">(</span><span class="pl-s1">args</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
    <span class="pl-kos">}</span>
<span class="pl-kos">}</span></pre></div>