/**
 * @fileOverview Testing the Entity interface.
 */

// var sinon  = require('sinon');
var chai = require('chai');
// var sinon = require('sinon');
var assert = chai.assert;

// var noop = function(){};

var tests = module.exports = {};

/**
 * Surface test the entity API.
 *
 * @param {Object} driver The driver object as defined in core.test.js
 */
tests.ctorInheritance = function(driver) {
  var majNum = driver.majNum;
  setup(function() {});
  teardown(function() {});


  // The numbering (e.g. 1.1.1) has nothing to do with order
  // The purpose is to provide a unique string so specific tests are
  // run by using the mocha --grep "1.1.1" option.

  suite(majNum + '.0 constructor and inheritance', function() {
    test(majNum + '.0.1 ctor arguments', function(){
      var entity = driver.entity.extend(function(arg1){
        assert.isEqual(arg1, 2, 'Arguments should be passed as is');
        assert.isEqual(arguments.length, 1, 'There should be only one argument');
      });
      entity(2);
    });

    test(majNum + '.0.2 inheritance', function() {
      var invoked = 0;
      var Entity = driver.entity.extend(function(){
        invoked++;
      });

      var entityOne = new Entity();
      var entityTwo = Entity();

      assert.instanceOf(entityOne, Entity, 'Using new keyword');
      assert.instanceOf(entityTwo, Entity, 'Just invoking');
      assert.equal(invoked, 2, 'ctor should be invoked twice');
    });
  });

};



@@ -204,42 +204,8 @@
 %7D;%0A%0A
-var tests = module.exports = %7B%7D;%0A%0A
 /**%0A
@@ -318,29 +318,22 @@
  */%0A
-tests.ctorInheritance
+module.exports
  = f
@@ -970,24 +970,146 @@
 2);%0A    %7D);%0A
+    test(majNum + '.0.1.1 Can extend without a ctor', function()%7B%0A      assert.doesNotThrow(driver.entity.extend);%0A    %7D);
 %0A    test(ma
@@ -1181,17 +1181,17 @@
     var 
-E
+e
 ntity = 
@@ -1213,32 +1213,33 @@
 xtend(function()
+ 
 %7B%0A        invoke
@@ -1231,16 +1231,26 @@
 %0A       
+ this.id =
  invoked
@@ -1290,17 +1290,17 @@
 e = new 
-E
+e
 ntity();
@@ -1322,17 +1322,17 @@
 tyTwo = 
-E
+e
 ntity();
@@ -1368,17 +1368,17 @@
 ityOne, 
-E
+e
 ntity, '
@@ -1433,17 +1433,17 @@
 ityTwo, 
-E
+e
 ntity, '
@@ -1531,17 +1531,1360 @@
     
-%7D);%0A  %7D);
+  assert.equal(entityOne.id, 1, '%22id%22 prop of entityOne should be 1');%0A      assert.equal(entityTwo.id, 2, '%22id%22 prop of entityTwo should be 2');%0A    %7D);%0A  %7D);%0A%0A  test(majNum + '.0.3 multiple inheritance', function() %7B%0A    var entityOne = driver.entity.extend(function(num)%7B%0A      this.num = num;%0A    %7D);%0A%0A    entityOne.prototype.incr = function() %7B%0A      this.num++;%0A    %7D;%0A%0A    var entityTwo = entityOne.extend(function(num, id) %7B%0A      this.id = id;%0A    %7D);%0A%0A    var entityThree = entityTwo.extend();%0A%0A    var one = entityOne(1);%0A    var two = entityTwo(3, 'two');%0A    var three = entityThree(6, 'three');%0A%0A    assert.isEqual(two.num, 3, '%22two.num%22 should have a value');%0A    assert.isEqual(one.num, 1, '%22one.num%22');%0A    assert.isEqual(three.num, 6, '%22three.num%22');%0A    assert.isEqual(two.id, 'two', '%22two.id%22');%0A    assert.isEqual(three.id, 'three', '%22three.id%22');%0A    assert.notProperty(one, 'id', '%22one.id%22');%0A%0A    two.incr();%0A%0A    assert.isEqual(two.num, 4, '%22two.num%22 after .incr()');%0A    assert.isEqual(three.num, 6, '%22three.num%22 after .incr()');%0A    assert.isEqual(one.num, 1, '%22one.num%22 after .incr()');%0A  %7D);%0A%0A  test(majNum + '.0.4 Static methods', function()%7B%0A    var entity = driver.entity.extend();%0A    entity.staticMethod = function()%7B%7D;%0A    var entityChild = entity.extend();%0A    assert.notProperty(entityChild, 'staticMethod');%0A  %7D);%0A
 %0A%0A%7D;

write ctor and inheritance tests