I'm creating a binary tree class in javascript and my test is failing but I don't see anything wrong with my method and I'm not receiving any diff. Any insight would be awesome.
Here's my class:
    function binaryTree() {
      this.root = null;
    };
    binaryTree.prototype = {
    constructor: binaryTree,
    add: function(val) {
        var root = this.root;
        if(!root) {
          this.root = new Node(val);
          return;
        }
        var currentNode = root;
        var newNode = new Node(val);
        while(currentNode) {
          if(val < currentNode.value) {
            if(!currentNode.left) {
              currentNode.left = newNode;
              break;
            }
            else {
              currentNode = currentNode.left;
            }
          }
          else {
            if(!currentNode.right) {
              currentNode.right = newNode;
              break;
            }
            else {
              currentNode = currentNode.right;
            }
          }
        }
      }
Here's my test:
it('adds values to the binary tree', function () {
  var test = new binaryTree();
  test.add(7);
  test.add(43);
  test.add(13);
  test.add(27);
  test.add(82);
  test.add(2);
  test.add(19);
  test.add(8);
  test.add(1);
  test.add(92);
  expect(test).to.equal({
    root:
     { value: 7,
       left:
        { value: 2,
          left: { value: 1, left: null, right: null },
          right: null },
       right:
        { value: 43,
          left:
           { value: 13,
             left: { value: 8, left: null, right: null },
             right:
              { value: 27,
                left: { value: 19, left: null, right: null },
                right: null } },
          right:
           { value: 82,
             left: null,
             right: { value: 92, left: null, right: null } } } }
  });
});
And here is the error I'm getting:
1) binary tree tests adds values to the binary tree:
    AssertionError: expected { Object (root) } to equal { Object (root) }
    + expected - actual
If I mess around with the values in the test object I see a diff appear so it looks to me like everything is equal and I'm stumped. I'd really appreciate it if I could get a second pair of eyes on this.
 
     
    