From 296bb0d73ed0ad5b18ebce89be40b50323e8bda2 Mon Sep 17 00:00:00 2001 From: Fabien Franzen Date: Tue, 29 Jul 2014 14:05:18 +0200 Subject: [PATCH] Minor touchups --- test/relations.test.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/relations.test.js b/test/relations.test.js index b417112b..3339bb94 100644 --- a/test/relations.test.js +++ b/test/relations.test.js @@ -1588,6 +1588,7 @@ describe('relations', function () { link.product(product2); cat.save(function(err, cat) { var product = cat.items.at(0); + product.should.not.have.property('productId'); product.id.should.eql(product1.id); product.name.should.equal(product1.name); var product = cat.items.at(1); @@ -1756,6 +1757,12 @@ describe('relations', function () { }); it('should include nested related items on scope', function(done) { + + // There's some date duplication going on, so it might + // make sense to override toObject on a case-by-case basis + // to sort this out (delete links, keep people). + // In loopback, an afterRemote filter could do this as well. + Book.find({ include: 'people' }, function(err, books) { var obj = books[0].toObject(); @@ -1767,6 +1774,10 @@ describe('relations', function () { obj.links[1].name.should.equal('Reader 1'); obj.people.should.have.length(2); + + obj.people[0].name.should.equal('Author 1'); + obj.people[0].notes.should.equal('Something ...'); + obj.people[0].linked.name.should.equal('Author 1'); obj.people[1].linked.name.should.equal('Reader 1');