Fix ModelDefinition toJSON bug

This commit is contained in:
Fabien Franzen 2014-08-17 18:01:52 +02:00
parent c3c2907248
commit 291e7b2c74
2 changed files with 4 additions and 2 deletions

View File

@ -265,7 +265,7 @@ ModelDefinition.prototype.toJSON = function (forceRebuild) {
this.json = null; this.json = null;
} }
if (this.json) { if (this.json) {
return json; return this.json;
} }
var json = { var json = {
name: this.name, name: this.name,

View File

@ -37,6 +37,8 @@ describe('ModelDefinition class', function () {
assert.equal(json.properties.joinedAt.type, "Date"); assert.equal(json.properties.joinedAt.type, "Date");
assert.equal(json.properties.age.type, "Number"); assert.equal(json.properties.age.type, "Number");
assert.deepEqual(User.toJSON(), json);
done(); done();
}); });