</code></pre>
</div>
<div id="unit-tests" class="section level2" number="8.8">
<h2><span class="header-section-number">8.8</span> Unit Tests</h2>
<p>The best way to write unit tests for htmlwidgets is to test the object created by <code>htmlwidgets::createWidget</code>. Below we provide an example using testthat<span class="citation">(Wickham <a href="#ref-R-testthat" role="doc-biblioref">2020</a>)</span>, running <code>expect*</code> functions on the output of <code>gio</code>.</p>
<div class="sourceCode" 