Unit testing with external library in Jasmine
<p>How to unit test your code if it's heavily belongs to external library and within each of its methods it calls some external library function.
If everything to mock, than code coverage like Istanbul don't count those lines mocked. Who has experience in unit testing with involvement of external dependencies and libraries, what is the best practice?</p>

<p>For instance, we have 2 internal functions and 3 external library functions.
If mock those external ones, than Istanbul doesn't count those lines as covered.</p>

<pre><code>function internalFoo1(input) {
 var result = internalFoo2(input*2);
 var finalResult = externalLibraryBar1(result);
 return result;
};

function internalFoo2(value) {
  var operation = externalLibraryBar2(value*2);
  var response = externalLibraryBar3(operation);
  return response;
}
</code></pre>

<p>How to write a test for internalFoo1() so unit test will cover all its code lines, as well internalFoo2() one.</p>