title: Unit testing: Input/output
body: <p>I am trying to run a unit test for the following code: This code below only checks if the function is true.</p>
  
  <p>Here is the Unit testing code:</p>
  
  <pre><code>  import {encodeLengthHex, toHex } from './utils';
  
  // testing new function 
  describe('EncodeLengthHex', () =&gt; {   //mocking the method
  test('Testing Function toHex ', () =&gt; { // declaring the method
  const str = 128 // initial value
  const actual = encodeLengthHex(str) // calculate the value
  expect(actual).toMatchSnapshot(); // checking whether is true
  })
  });
  </code></pre>
  
  <p>Here is the main code:</p>
  
  <pre><code> export function encodeLengthHex(n) {
  if (n &lt;= 127) {
    return toHex(n);
  }
  const nHex = toHex(n);
  const lengthOfLengthByte = 128 + nHex.length / 2;
    return toHex(lengthOfLengthByte) + nHex;
  </code></pre>
  
  <p>Function is passing. But how could I add a few inputs to test and compare when this function pass or fail. Thanks</p>