Reset json when building model definition
This commit is contained in:
parent
170dc661f4
commit
3f517a4c0a
|
@ -210,6 +210,7 @@ ModelDefinition.prototype.build = function (forceRebuild) {
|
|||
this.properties = null;
|
||||
this.relations = [];
|
||||
this._ids = null;
|
||||
this.json = null;
|
||||
}
|
||||
if (this.properties) {
|
||||
return this.properties;
|
||||
|
|
|
@ -55,6 +55,8 @@ describe('ModelDefinition class', function () {
|
|||
});
|
||||
|
||||
User.build();
|
||||
|
||||
var json = User.toJSON();
|
||||
|
||||
User.defineProperty("id", {type: "number", id: true});
|
||||
assert.equal(User.properties.name.type, String);
|
||||
|
@ -62,8 +64,12 @@ describe('ModelDefinition class', function () {
|
|||
assert.equal(User.properties.approved.type, Boolean);
|
||||
assert.equal(User.properties.joinedAt.type, Date);
|
||||
assert.equal(User.properties.age.type, Number);
|
||||
|
||||
|
||||
assert.equal(User.properties.id.type, Number);
|
||||
|
||||
json = User.toJSON();
|
||||
assert.deepEqual(json.properties.id, {type: 'Number', id: true});
|
||||
|
||||
done();
|
||||
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue