From 825fa3171c2f37e3cbb5d6255d4875f07d05ccd8 Mon Sep 17 00:00:00 2001 From: ssh24 Date: Tue, 23 May 2017 15:11:11 -0400 Subject: [PATCH] Fix count of properties --- test/model-inheritance.test.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/test/model-inheritance.test.js b/test/model-inheritance.test.js index 2606e573..185384ce 100644 --- a/test/model-inheritance.test.js +++ b/test/model-inheritance.test.js @@ -174,9 +174,9 @@ describe('Model class inheritance', function() { customer.should.have.property('customerId', 'c01'); customer.should.have.property('bio', undefined); - // The properties are defined at prototype level + // The properties are defined at prototype level assert.equal(Object.keys(customer).filter(function(k) { - // Remove internal properties + // Remove internal properties return k.indexOf('__') === -1; }).length, 0); var count = 0; @@ -184,13 +184,15 @@ describe('Model class inheritance', function() { if (p.indexOf('__') === 0) { continue; } - if (typeof customer[p] !== 'function') { + // Please note there is an injected id from User prototype which is a function + // On node >= 7, this property does not show up + if (typeof customer[p] !== 'function' && p !== 'id') { count++; } } - assert.equal(count, 7); // Please note there is an injected id from User prototype + assert.equal(count, 6); assert.equal(Object.keys(customer.toObject()).filter(function(k) { - // Remove internal properties + // Remove internal properties return k.indexOf('__') === -1; }).length, 6);