code review, better asserts
This commit is contained in:
parent
5aee1fe17e
commit
fed0396d9e
|
@ -20,28 +20,18 @@ describe('exclude properties ', function() {
|
||||||
{idInjection: false, excludeBaseProperties: ['id']});
|
{idInjection: false, excludeBaseProperties: ['id']});
|
||||||
// User will have these properties: name, password
|
// User will have these properties: name, password
|
||||||
var properties = User.definition.properties;
|
var properties = User.definition.properties;
|
||||||
|
assert(('name', 'password' in properties));
|
||||||
var notFound = true;
|
// id should not be found in the properties list
|
||||||
for (var p in properties) {
|
assert(!('id' in properties));
|
||||||
if (p == 'id') {
|
|
||||||
notFound = false; // id should not be found in the properties list
|
|
||||||
}
|
|
||||||
}
|
|
||||||
assert.equal(notFound, true);
|
|
||||||
|
|
||||||
// this excludes id property from the base model and and password property coming from base 'User' model since customer is
|
// this excludes id property from the base model and and password property coming from base 'User' model since customer is
|
||||||
// extended from User.
|
// extended from User.
|
||||||
var Customer = User.extend('Customer', {vip: {type: String}},
|
var Customer = User.extend('Customer', {vip: {type: String}},
|
||||||
{idInjection: false, excludeBaseProperties: ['password']});
|
{idInjection: false, excludeBaseProperties: ['password']});
|
||||||
// Customer will have these properties: name, vip
|
// Customer will have these properties: name(from UserModel) & vip
|
||||||
properties = Customer.definition.properties;
|
properties = Customer.definition.properties;
|
||||||
notFound = true;
|
assert(('name', 'vip' in properties));
|
||||||
for (p in properties) {
|
// id and password properties should not be found in the properties list
|
||||||
if (p == 'id' || p == 'password') {
|
assert(!('id', 'password' in properties));
|
||||||
notFound = false; // id and password properties should not be found in the properties list
|
|
||||||
}
|
|
||||||
}
|
|
||||||
assert.equal(notFound, true);
|
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue