Add missing type to Role properties definition
Fix "created" and "modified" to be defined with type "date".
This commit is contained in:
parent
5fd79b14f4
commit
c072d0695d
|
@ -12,11 +12,12 @@
|
||||||
"required": true
|
"required": true
|
||||||
},
|
},
|
||||||
"description": "string",
|
"description": "string",
|
||||||
|
|
||||||
"created": {
|
"created": {
|
||||||
|
"type":"date",
|
||||||
"defaultFn": "now"
|
"defaultFn": "now"
|
||||||
},
|
},
|
||||||
"modified": {
|
"modified": {
|
||||||
|
"type":"date",
|
||||||
"defaultFn": "now"
|
"defaultFn": "now"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -96,6 +96,14 @@ describe('role model', function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should generate created/modified properties', () => {
|
||||||
|
return Role.create({name: 'ADMIN'})
|
||||||
|
.then(role => {
|
||||||
|
expect(role.toJSON().created).to.be.instanceOf(Date);
|
||||||
|
expect(role.toJSON().modified).to.be.instanceOf(Date);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it('should define role/user relations', function(done) {
|
it('should define role/user relations', function(done) {
|
||||||
User.create({name: 'Raymond', email: 'x@y.com', password: 'foobar'}, function(err, user) {
|
User.create({name: 'Raymond', email: 'x@y.com', password: 'foobar'}, function(err, user) {
|
||||||
if (err) return done(err);
|
if (err) return done(err);
|
||||||
|
|
Loading…
Reference in New Issue