From 2f71622e1123e81096e184653cda9411dd30121d Mon Sep 17 00:00:00 2001 From: Tom Kirkpatrick Date: Fri, 8 Jan 2016 11:09:29 +0100 Subject: [PATCH] Add unit test to verify fix for #754 --- test/include.test.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/test/include.test.js b/test/include.test.js index 07cf73a9..1209fcc1 100644 --- a/test/include.test.js +++ b/test/include.test.js @@ -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() {