不要怂,就是干,撸起袖子干!

Commit 5acd3542 by José Moreira

Instance.get: Test Unit

1 parent a6d8d0fb
Showing with 24 additions and 0 deletions
......@@ -1200,6 +1200,30 @@ describe(Support.getTestDialectTeaser("DAO"), function () {
})
})
it.only('dont return instance that is not defined', function ( done ) {
var self = this;
self.Project.create({ lovelyUserId: null })
.then(function ( project ) {
return self.Project.find({
where: {
id: project.id,
},
include: [
{ model: self.User, as: 'LovelyUser' }
]
})
})
.then(function ( project ) {
var json = project.toJSON();
expect( json.LovelyUser ).to.be.equal( null )
})
.done( done )
.catch( done );
});
it('returns an object containing all values', function(done) {
var user = this.User.build({ username: 'test.user', age: 99, isAdmin: true })
expect(user.toJSON()).to.deep.equal({ username: 'test.user', age: 99, isAdmin: true, id: null })
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!