Merge pull request #227 from fabien/fix/definition-tojson

Fix ModelDefinition toJSON bug
This commit is contained in:
Raymond Feng 2014-08-17 22:17:05 -07:00
commit 38431753a1
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();
}); });