<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Kauê Buriti</title>
    <description>The latest articles on DEV Community by Kauê Buriti (@kaueburiti).</description>
    <link>https://dev.to/kaueburiti</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F186144%2F9431dc02-3d8a-454c-a81a-31e243c3cd93.jpg</url>
      <title>DEV Community: Kauê Buriti</title>
      <link>https://dev.to/kaueburiti</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/kaueburiti"/>
    <language>en</language>
    <item>
      <title>How do you test react containers using @testing-library/react</title>
      <dc:creator>Kauê Buriti</dc:creator>
      <pubDate>Mon, 01 Jul 2019 16:49:37 +0000</pubDate>
      <link>https://dev.to/kaueburiti/how-do-you-test-react-containers-using-testing-library-react-2f55</link>
      <guid>https://dev.to/kaueburiti/how-do-you-test-react-containers-using-testing-library-react-2f55</guid>
      <description>&lt;p&gt;The intent to @testing-library/react is test what the user see, the things that are rendered on the DOM. As long I could read, that is the philosophy behind the library, and that just fine!&lt;/p&gt;

&lt;p&gt;But I was wondering, how do you people test react containers when using this library?&lt;/p&gt;

&lt;p&gt;Imagine the situation bellow:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const onChange = () =&amp;gt; console.log('Hey!')

const Container = () =&amp;gt; &amp;lt;Component onChange={onChange} /&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;If it was important to test that Component receives the onChange, how would you do that?&lt;/p&gt;

&lt;p&gt;I saw some posts suggesting to mock the Component and add a CSS class (!) based on the fact if it has or has not the prop. But this does not smell very good to me.&lt;/p&gt;

&lt;p&gt;Should we just don't test this kind of situation?&lt;/p&gt;

</description>
      <category>help</category>
    </item>
  </channel>
</rss>
