Add unit test to verify fix for #754

This commit is contained in:
Tom Kirkpatrick 2016-01-08 11:09:29 +01:00 committed by Simon Ho
parent 3bc2dacb1b
commit 2f71622e11
1 changed files with 22 additions and 0 deletions

View File

@ -428,6 +428,28 @@ describe('include', function () {
});
});
it('should save related items separately', function(done) {
User.find({
include: 'posts'
})
.then(function(users) {
var posts = users[0].posts();
posts.should.have.length(3);
return users[0].save();
})
.then(function(updatedUser) {
return User.findById(updatedUser.id, {
include: 'posts'
});
})
.then(function(user) {
var posts = user.posts();
posts.should.have.length(3);
})
.then(done)
.catch(done);
});
describe('performance', function () {
var all;
beforeEach(function() {