From fed0396d9e3d6ae384da7021defe14e549698c57 Mon Sep 17 00:00:00 2001 From: rashmihunt Date: Thu, 11 May 2017 09:59:39 -0700 Subject: [PATCH] code review, better asserts --- test/exclude-base-props.test.js | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/test/exclude-base-props.test.js b/test/exclude-base-props.test.js index 40135542..8bc6f2d9 100644 --- a/test/exclude-base-props.test.js +++ b/test/exclude-base-props.test.js @@ -20,28 +20,18 @@ describe('exclude properties ', function() { {idInjection: false, excludeBaseProperties: ['id']}); // User will have these properties: name, password var properties = User.definition.properties; - - var notFound = true; - for (var p in properties) { - if (p == 'id') { - notFound = false; // id should not be found in the properties list - } - } - assert.equal(notFound, true); - + assert(('name', 'password' in properties)); + // id should not be found in the properties list + assert(!('id' in properties)); // this excludes id property from the base model and and password property coming from base 'User' model since customer is // extended from User. var Customer = User.extend('Customer', {vip: {type: String}}, {idInjection: false, excludeBaseProperties: ['password']}); - // Customer will have these properties: name, vip + // Customer will have these properties: name(from UserModel) & vip properties = Customer.definition.properties; - notFound = true; - for (p in properties) { - if (p == 'id' || p == 'password') { - notFound = false; // id and password properties should not be found in the properties list - } - } - assert.equal(notFound, true); + assert(('name', 'vip' in properties)); + // id and password properties should not be found in the properties list + assert(!('id', 'password' in properties)); done(); }); });