title: Testing objects equality in NodeJS
body: <p>We are writing tests for a program. We want to write a functionnal test that verifies that the output of the program matches some expectation.
  The object returned is a complex JS object (with nested objects, many properties... etc).</p>
  
  <p>We want to test that this obviously matches what we need. 
  Up until now, we were "browsing" the object and the expected outcome, checking for each property, and each nested object. That is very cumbersome and we were wondering if there was any library that would 'build' all the tests, based just on the object. Something like this for example.</p>
  
  <pre><code>var res = {
    a: {
      alpha: [1,2,3],
      beta: "Hello",
      gamma: "World"
      },
      },
      b: 123,
      c: "It depends"
    }
  };
  var expectation = {
    a: {
      alpha: [1,2,4],
      beta: "Hello",
      gamma: "World"
      },
      },
      b: 123,
      c: "It depends"
    }
  };
  
  assert(res, expectation) // -&gt; Raises an error because res[a][b][2] is different from expectation[a][b][2].
  </code></pre>
  
  <p>[In the example, I have simplified the complexity of our object...]</p>
  
  <p><strong>I should insist on the fact that we need a piece of code that is smart enough to tell us what is different, rather than just tell us that the 2 objects are different. We now about deep equality, but we haven't found anything that actually tells us the differences.</strong></p>