Merge pull request #1194 from strongloop/1237/fix-block-padding

Fix block padding
This commit is contained in:
Simon Ho 2016-12-21 14:17:42 -08:00 committed by GitHub
commit d095cc1161
24 changed files with 0 additions and 232 deletions

View File

@ -1,7 +0,0 @@
{
"rules": {
// NOTE(bajtos) We should eventually get rid of this override,
// and fix those 200+ violations instead
"padded-blocks": "off"
}
}

View File

@ -12,7 +12,6 @@ var async = require('async');
var db, User; var db, User;
describe('basic-querying', function() { describe('basic-querying', function() {
before(function(done) { before(function(done) {
db = getSchema(); db = getSchema();
User = db.define('User', { User = db.define('User', {
@ -26,7 +25,6 @@ describe('basic-querying', function() {
}); });
db.automigrate(done); db.automigrate(done);
}); });
describe('ping', function() { describe('ping', function() {
@ -39,7 +37,6 @@ describe('basic-querying', function() {
}); });
describe('findById', function() { describe('findById', function() {
before(function(done) { before(function(done) {
User.destroyAll(done); User.destroyAll(done);
}); });
@ -64,7 +61,6 @@ describe('basic-querying', function() {
}); });
}); });
}); });
}); });
describe('findByIds', function() { describe('findByIds', function() {
@ -125,11 +121,9 @@ describe('basic-querying', function() {
done(); done();
}); });
}); });
}); });
describe('find', function() { describe('find', function() {
before(seed); before(seed);
before(function setupDelayingLoadedHook() { before(function setupDelayingLoadedHook() {
@ -530,12 +524,10 @@ describe('basic-querying', function() {
var remaining = 0; var remaining = 0;
function sample(fields) { function sample(fields) {
return { return {
expect: function(arr) { expect: function(arr) {
remaining++; remaining++;
User.find({fields: fields}, function(err, users) { User.find({fields: fields}, function(err, users) {
remaining--; remaining--;
if (err) return done(err); if (err) return done(err);
@ -572,11 +564,9 @@ describe('basic-querying', function() {
sample(['id']).expect(['id']); sample(['id']).expect(['id']);
sample(['email']).expect(['email']); sample(['email']).expect(['email']);
}); });
}); });
describe('count', function() { describe('count', function() {
before(seed); before(seed);
it('should query total count', function(done) { it('should query total count', function(done) {
@ -599,7 +589,6 @@ describe('basic-querying', function() {
}); });
describe('findOne', function() { describe('findOne', function() {
before(seed); before(seed);
it('should find first record (default sort by id)', function(done) { it('should find first record (default sort by id)', function(done) {
@ -655,11 +644,9 @@ describe('basic-querying', function() {
}); });
}); });
}); });
}); });
describe('exists', function() { describe('exists', function() {
before(seed); before(seed);
it('should check whether record exist', function(done) { it('should check whether record exist', function(done) {

View File

@ -22,7 +22,6 @@ function skip(name) {
} }
module.exports = function testSchema(exportCasesHere, dataSource) { module.exports = function testSchema(exportCasesHere, dataSource) {
batch = exportCasesHere; batch = exportCasesHere;
schemaName = dataSource.name; schemaName = dataSource.name;
if (dataSource.name.match(/^\/.*\/test\/\.\.$/)) { if (dataSource.name.match(/^\/.*\/test\/\.\.$/)) {
@ -54,7 +53,6 @@ module.exports = function testSchema(exportCasesHere, dataSource) {
// dataSource.disconnect(); // dataSource.disconnect();
console.log('Test done in %dms\n', Date.now() - start); console.log('Test done in %dms\n', Date.now() - start);
} }
}; };
Object.defineProperty(module.exports, 'it', { Object.defineProperty(module.exports, 'it', {
@ -98,7 +96,6 @@ function testOrm(dataSource) {
var Post, User, Passport, Log, Dog; var Post, User, Passport, Log, Dog;
it('should define class', function(test) { it('should define class', function(test) {
User = dataSource.define('User', { User = dataSource.define('User', {
name: {type: String, index: true}, name: {type: String, index: true},
email: {type: String, index: true}, email: {type: String, index: true},
@ -198,7 +195,6 @@ function testOrm(dataSource) {
test.done(); test.done();
} }
}); });
}); });
it('should initialize object properly', function(test) { it('should initialize object properly', function(test) {
@ -446,7 +442,6 @@ function testOrm(dataSource) {
}); });
it('should navigate variations of belongsTo regardless of column name', function(test) { it('should navigate variations of belongsTo regardless of column name', function(test) {
Dog.create({name: 'theDog'}, function(err, obj) { Dog.create({name: 'theDog'}, function(err, obj) {
test.ok(obj instanceof Dog); test.ok(obj instanceof Dog);
Log.create({name: 'theLog', ownerId: obj.id}, function(err, obj) { Log.create({name: 'theLog', ownerId: obj.id}, function(err, obj) {
@ -471,7 +466,6 @@ function testOrm(dataSource) {
}); });
it('hasMany should support additional conditions', function(test) { it('hasMany should support additional conditions', function(test) {
User.create(function(e, u) { User.create(function(e, u) {
u.posts.create({}, function(e, p) { u.posts.create({}, function(e, p) {
u.posts({where: {id: p.id}}, function(e, posts) { u.posts({where: {id: p.id}}, function(e, posts) {
@ -480,7 +474,6 @@ function testOrm(dataSource) {
}); });
}); });
}); });
}); });
/* eslint-disable max-len */ /* eslint-disable max-len */
@ -498,7 +491,6 @@ function testOrm(dataSource) {
User.findById(post.userId, function(err, user) { User.findById(post.userId, function(err, user) {
User.create(function(err, voidUser) { User.create(function(err, voidUser) {
Post.create({userId: user.id}, function() { Post.create({userId: user.id}, function() {
// There can't be any concurrency because we are counting requests // There can't be any concurrency because we are counting requests
// We are first testing cases when user has posts // We are first testing cases when user has posts
user.posts(function(err, data) { user.posts(function(err, data) {
@ -535,14 +527,11 @@ function testOrm(dataSource) {
}); });
}); });
}); });
}); });
}); });
} }
}); });
}); });
}); });
}); });
}); });
@ -740,7 +729,6 @@ function testOrm(dataSource) {
function numerically(a, b) { function numerically(a, b) {
return a - b; return a - b;
} }
}); });
// if ( // if (
@ -1143,5 +1131,4 @@ function testOrm(dataSource) {
}); });
}); });
}); });
} }

View File

@ -12,7 +12,6 @@ var async = require('async');
var db, User, options, filter; var db, User, options, filter;
describe('crud-with-options', function() { describe('crud-with-options', function() {
before(function(done) { before(function(done) {
db = getSchema(); db = getSchema();
User = db.define('User', { User = db.define('User', {
@ -29,11 +28,9 @@ describe('crud-with-options', function() {
filter = {fields: ['name', 'id']}; filter = {fields: ['name', 'id']};
db.automigrate(['User'], done); db.automigrate(['User'], done);
}); });
describe('findById', function() { describe('findById', function() {
before(function(done) { before(function(done) {
User.destroyAll(done); User.destroyAll(done);
}); });
@ -190,11 +187,9 @@ describe('crud-with-options', function() {
done(err); done(err);
}); });
}); });
}); });
describe('findByIds', function() { describe('findByIds', function() {
before(function(done) { before(function(done) {
var people = [ var people = [
{id: 1, name: 'a', vip: true}, {id: 1, name: 'a', vip: true},
@ -235,11 +230,9 @@ describe('crud-with-options', function() {
done(); done();
}); });
}); });
}); });
describe('find', function() { describe('find', function() {
before(seed); before(seed);
it('should allow find(cb)', function(done) { it('should allow find(cb)', function(done) {
@ -307,11 +300,9 @@ describe('crud-with-options', function() {
User.find({limit: 3}, {}, 'invalid cb'); User.find({limit: 3}, {}, 'invalid cb');
}).should.throw('The cb argument must be a function'); }).should.throw('The cb argument must be a function');
}); });
}); });
describe('count', function() { describe('count', function() {
before(seed); before(seed);
it('should allow count(cb)', function(done) { it('should allow count(cb)', function(done) {
@ -340,11 +331,9 @@ describe('crud-with-options', function() {
done(); done();
}); });
}); });
}); });
describe('findOne', function() { describe('findOne', function() {
before(seed); before(seed);
it('should allow findOne(cb)', function(done) { it('should allow findOne(cb)', function(done) {
@ -387,11 +376,9 @@ describe('crud-with-options', function() {
done(); done();
}, undefined); }, undefined);
}); });
}); });
describe('exists', function() { describe('exists', function() {
before(seed); before(seed);
it('should allow exists(id, cb)', function(done) { it('should allow exists(id, cb)', function(done) {
@ -414,11 +401,9 @@ describe('crud-with-options', function() {
}); });
}); });
}); });
}); });
describe('save', function() { describe('save', function() {
it('should allow save(options, cb)', function(done) { it('should allow save(options, cb)', function(done) {
var options = {foo: 'bar'}; var options = {foo: 'bar'};
var opts; var opts;
@ -435,11 +420,9 @@ describe('crud-with-options', function() {
done(); done();
}); });
}); });
}); });
describe('destroyAll with options', function() { describe('destroyAll with options', function() {
beforeEach(seed); beforeEach(seed);
it('should allow destroyAll(where, options, cb)', function(done) { it('should allow destroyAll(where, options, cb)', function(done) {
@ -486,11 +469,9 @@ describe('crud-with-options', function() {
}); });
}); });
}); });
}); });
describe('updateAll ', function() { describe('updateAll ', function() {
beforeEach(seed); beforeEach(seed);
it('should allow updateAll(where, data, cb)', function(done) { it('should allow updateAll(where, data, cb)', function(done) {
@ -537,9 +518,7 @@ describe('crud-with-options', function() {
}); });
}); });
}); });
}); });
}); });
describe('upsertWithWhere', function() { describe('upsertWithWhere', function() {

View File

@ -12,7 +12,6 @@ var should = require('./init.js');
var db, Model; var db, Model;
describe('datatypes', function() { describe('datatypes', function() {
before(function(done) { before(function(done) {
db = getSchema(); db = getSchema();
var Nested = db.define('Nested', {}); var Nested = db.define('Nested', {});
@ -112,7 +111,6 @@ describe('datatypes', function() {
done(); done();
}); });
} }
}); });
it('should respect data types when updating attributes', function(done) { it('should respect data types when updating attributes', function(done) {
@ -151,7 +149,6 @@ describe('datatypes', function() {
} }
function testDataInDB(done) { function testDataInDB(done) {
// verify that the value stored in the db is still an object // verify that the value stored in the db is still an object
function cb(err, data) { function cb(err, data) {
should.exist(data); should.exist(data);

View File

@ -54,7 +54,6 @@ var setupProducts = function(ids, done) {
}; };
describe('default scope', function() { describe('default scope', function() {
before(function(done) { before(function(done) {
db = getSchema(); db = getSchema();
@ -136,7 +135,6 @@ describe('default scope', function() {
}); });
describe('manipulation', function() { describe('manipulation', function() {
var ids = {}; var ids = {};
before(function(done) { before(function(done) {
@ -213,11 +211,9 @@ describe('default scope', function() {
done(); done();
}); });
}); });
}); });
describe('findById', function() { describe('findById', function() {
var ids = {}; var ids = {};
before(function(done) { before(function(done) {
@ -248,11 +244,9 @@ describe('default scope', function() {
done(); done();
}); });
}); });
}); });
describe('find', function() { describe('find', function() {
var ids = {}; var ids = {};
before(function(done) { before(function(done) {
@ -322,11 +316,9 @@ describe('default scope', function() {
done(); done();
}); });
}); });
}); });
describe('exists', function() { describe('exists', function() {
var ids = {}; var ids = {};
before(function(done) { before(function(done) {
@ -372,11 +364,9 @@ describe('default scope', function() {
done(); done();
}); });
}); });
}); });
describe('count', function() { describe('count', function() {
var ids = {}; var ids = {};
before(function(done) { before(function(done) {
@ -422,11 +412,9 @@ describe('default scope', function() {
done(); done();
}); });
}); });
}); });
describe('removeById', function() { describe('removeById', function() {
var ids = {}; var ids = {};
function isDeleted(id, done) { function isDeleted(id, done) {
@ -482,11 +470,9 @@ describe('default scope', function() {
done(); done();
}); });
}); });
}); });
describe('update', function() { describe('update', function() {
var ids = {}; var ids = {};
before(function(done) { before(function(done) {
@ -529,11 +515,9 @@ describe('default scope', function() {
done(); done();
}); });
}); });
}); });
describe('remove', function() { describe('remove', function() {
var ids = {}; var ids = {};
before(function(done) { before(function(done) {
@ -603,11 +587,9 @@ describe('default scope', function() {
}); });
}); });
}); });
}); });
describe('scopes', function() { describe('scopes', function() {
var ids = {}; var ids = {};
before(function(done) { before(function(done) {
@ -643,11 +625,9 @@ describe('default scope', function() {
done(); done();
}); });
}); });
}); });
describe('scope function', function() { describe('scope function', function() {
before(function(done) { before(function(done) {
db.automigrate(done); db.automigrate(done);
}); });
@ -695,11 +675,9 @@ describe('default scope', function() {
done(); done();
}); });
}); });
}); });
describe('relations', function() { describe('relations', function() {
var ids = {}; var ids = {};
before(function(done) { before(function(done) {
@ -818,11 +796,9 @@ describe('default scope', function() {
}); });
}); });
}); });
}); });
describe('with include option', function() { describe('with include option', function() {
before(function(done) { before(function(done) {
db.automigrate(done); db.automigrate(done);
}); });
@ -844,7 +820,5 @@ describe('default scope', function() {
done(); done();
}); });
}); });
}); });
}); });

View File

@ -76,5 +76,4 @@ describe('defaults', function() {
}); });
}); });
}); });
}); });

View File

@ -14,9 +14,7 @@ var GeoPoint = require('../lib/geo').GeoPoint;
var DELTA = 0.0000001; var DELTA = 0.0000001;
describe('GeoPoint', function() { describe('GeoPoint', function() {
describe('constructor', function() { describe('constructor', function() {
it('should support a valid array', function() { it('should support a valid array', function() {
var point = new GeoPoint([-34, 150]); var point = new GeoPoint([-34, 150]);
@ -80,33 +78,26 @@ describe('GeoPoint', function() {
}; };
fn.should.throw(); fn.should.throw();
}); });
}); });
describe('toString()', function() { describe('toString()', function() {
it('should return a string in the form "lat,lng"', function() { it('should return a string in the form "lat,lng"', function() {
var point = new GeoPoint({lat: -34, lng: 150}); var point = new GeoPoint({lat: -34, lng: 150});
point.toString().should.equal('-34,150'); point.toString().should.equal('-34,150');
}); });
}); });
describe('distance calculation between two points', function() { describe('distance calculation between two points', function() {
var here = new GeoPoint({lat: 40.77492964101182, lng: -73.90950187151662}); var here = new GeoPoint({lat: 40.77492964101182, lng: -73.90950187151662});
var there = new GeoPoint({lat: 40.7753227, lng: -73.909217}); var there = new GeoPoint({lat: 40.7753227, lng: -73.909217});
it('should return value in miles by default', function() { it('should return value in miles by default', function() {
var distance = GeoPoint.distanceBetween(here, there); var distance = GeoPoint.distanceBetween(here, there);
distance.should.be.a.Number; distance.should.be.a.Number;
distance.should.be.approximately(0.03097916611592679, DELTA); distance.should.be.approximately(0.03097916611592679, DELTA);
}); });
it('should return value using specified unit', function() { it('should return value using specified unit', function() {
/* Supported units: /* Supported units:
* - `radians` * - `radians`
* - `kilometers` * - `kilometers`
@ -140,7 +131,5 @@ describe('GeoPoint', function() {
distance.should.be.a.Number; distance.should.be.a.Number;
distance.should.be.approximately(0.0004483676593058972, DELTA); distance.should.be.approximately(0.0004483676593058972, DELTA);
}); });
}); });
}); });

View File

@ -17,7 +17,6 @@ var j = require('../'),
db, User; db, User;
describe('hooks', function() { describe('hooks', function() {
before(function(done) { before(function(done) {
db = getSchema(); db = getSchema();
@ -32,7 +31,6 @@ describe('hooks', function() {
}); });
describe('initialize', function() { describe('initialize', function() {
afterEach(function() { afterEach(function() {
User.afterInitialize = null; User.afterInitialize = null;
}); });
@ -57,11 +55,9 @@ describe('hooks', function() {
done(); done();
}); });
}); });
}); });
describe('create', function() { describe('create', function() {
afterEach(removeHooks('Create')); afterEach(removeHooks('Create'));
it('should be triggered on create', function(done) { it('should be triggered on create', function(done) {
@ -212,7 +208,6 @@ describe('hooks', function() {
}); });
}); });
}); });
}); });
describe('update', function() { describe('update', function() {
@ -278,7 +273,6 @@ describe('hooks', function() {
}); });
describe('destroy', function() { describe('destroy', function() {
afterEach(removeHooks('Destroy')); afterEach(removeHooks('Destroy'));
it('should be triggered on destroy', function(done) { it('should be triggered on destroy', function(done) {
@ -311,7 +305,6 @@ describe('hooks', function() {
}); });
}); });
}); });
}); });
describe('lifecycle', function() { describe('lifecycle', function() {
@ -438,7 +431,6 @@ describe('hooks', function() {
done(); done();
}); });
}); });
}); });
}); });

View File

@ -15,7 +15,6 @@ var DataSource = require('../').DataSource;
var db, User, Profile, AccessToken, Post, Passport, City, Street, Building, Assembly, Part; var db, User, Profile, AccessToken, Post, Passport, City, Street, Building, Assembly, Part;
describe('include', function() { describe('include', function() {
before(setup); before(setup);
it('should fetch belongsTo relation', function(done) { it('should fetch belongsTo relation', function(done) {
@ -63,7 +62,6 @@ describe('include', function() {
it('should fetch Passport - Owner - Posts', function(done) { it('should fetch Passport - Owner - Posts', function(done) {
Passport.find({include: {owner: 'posts'}}, function(err, passports) { Passport.find({include: {owner: 'posts'}}, function(err, passports) {
should.not.exist(err); should.not.exist(err);
should.exist(passports); should.exist(passports);
passports.length.should.be.ok; passports.length.should.be.ok;
@ -689,13 +687,11 @@ describe('include', function() {
// Create a part // Create a part
assembly.parts.create({partNumber: 'door'}, function(err, part4) { assembly.parts.create({partNumber: 'door'}, function(err, part4) {
Assembly.find({include: 'parts'}, function(err, assemblies) { Assembly.find({include: 'parts'}, function(err, assemblies) {
assemblies.length.should.equal(1); assemblies.length.should.equal(1);
assemblies[0].parts().length.should.equal(2); assemblies[0].parts().length.should.equal(2);
done(); done();
}); });
}); });
}); });
}); });
@ -1082,7 +1078,6 @@ function setup(done) {
} }
); );
} }
}); });
} }
@ -1164,7 +1159,6 @@ describe('Model instance with included relation .toJSON()', function() {
function(err) { function(err) {
done(err); done(err);
}); });
}); });
function createChallengers(callback) { function createChallengers(callback) {
@ -1188,7 +1182,6 @@ describe('Model instance with included relation .toJSON()', function() {
it('should recursively serialize objects', function(done) { it('should recursively serialize objects', function(done) {
var filter = {include: {gameParticipations: 'results'}}; var filter = {include: {gameParticipations: 'results'}};
ChallengerModel.find(filter, function(err, challengers) { ChallengerModel.find(filter, function(err, challengers) {
var levelOneInclusion = challengers[0].toJSON().gameParticipations[0]; var levelOneInclusion = challengers[0].toJSON().gameParticipations[0];
assert(levelOneInclusion.__data === undefined, '.__data of a level 1 inclusion is undefined.'); assert(levelOneInclusion.__data === undefined, '.__data of a level 1 inclusion is undefined.');

View File

@ -31,7 +31,6 @@ var json = {
}; };
describe('Introspection of model definitions from JSON', function() { describe('Introspection of model definitions from JSON', function() {
it('should handle simple types', function() { it('should handle simple types', function() {
assert.equal(introspectType('123'), 'string'); assert.equal(introspectType('123'), 'string');
assert.equal(introspectType(true), 'boolean'); assert.equal(introspectType(true), 'boolean');
@ -130,6 +129,5 @@ describe('Introspection of model definitions from JSON', function() {
assert.deepEqual(obj, copy); assert.deepEqual(obj, copy);
done(); done();
}); });
}); });

View File

@ -14,7 +14,6 @@ var ModelBuilder = jdb.ModelBuilder;
var DataSource = jdb.DataSource; var DataSource = jdb.DataSource;
describe('ModelBuilder', function() { describe('ModelBuilder', function() {
it('supports plain models', function(done) { it('supports plain models', function(done) {
var modelBuilder = new ModelBuilder(); var modelBuilder = new ModelBuilder();
@ -261,7 +260,6 @@ describe('ModelBuilder', function() {
follow.should.have.property('id'); follow.should.have.property('id');
assert.deepEqual(follow.id, {followerId: 1, followeeId: 2}); assert.deepEqual(follow.id, {followerId: 1, followeeId: 2});
}); });
}); });
describe('DataSource ping', function() { describe('DataSource ping', function() {
@ -399,7 +397,6 @@ describe('DataSource define model', function() {
Color.all(function(err, colors) { Color.all(function(err, colors) {
colors.should.have.lengthOf(3); colors.should.have.lengthOf(3);
}); });
}); });
it('emits events during attach', function() { it('emits events during attach', function() {
@ -436,7 +433,6 @@ describe('DataSource define model', function() {
var User = ds.define('User', {name: String, bio: String}, {strict: true}); var User = ds.define('User', {name: String, bio: String}, {strict: true});
User.create({name: 'Joe', age: 20}, function(err, user) { User.create({name: 'Joe', age: 20}, function(err, user) {
User.modelName.should.equal('User'); User.modelName.should.equal('User');
user.should.be.type('object'); user.should.be.type('object');
assert(user.name === 'Joe'); assert(user.name === 'Joe');
@ -480,7 +476,6 @@ describe('DataSource define model', function() {
User.modelName.should.equal('User'); User.modelName.should.equal('User');
User.create({name: 'Joe', age: 20}, function(err, user) { User.create({name: 'Joe', age: 20}, function(err, user) {
user.should.be.type('object').and.have.property('name', 'Joe'); user.should.be.type('object').and.have.property('name', 'Joe');
user.should.have.property('name', 'Joe'); user.should.have.property('name', 'Joe');
user.should.have.property('age', 20); user.should.have.property('age', 20);
@ -502,7 +497,6 @@ describe('DataSource define model', function() {
var User = ds.define('User', {}); var User = ds.define('User', {});
User.create({name: 'Joe', age: 20}, function(err, user) { User.create({name: 'Joe', age: 20}, function(err, user) {
User.modelName.should.equal('User'); User.modelName.should.equal('User');
user.should.be.type('object').and.have.property('name', 'Joe'); user.should.be.type('object').and.have.property('name', 'Joe');
user.should.have.property('name', 'Joe'); user.should.have.property('name', 'Joe');
@ -577,7 +571,6 @@ describe('DataSource define model', function() {
user.toObject().should.not.have.property('age'); user.toObject().should.not.have.property('age');
user.toObject(true).should.not.have.property('age'); user.toObject(true).should.not.have.property('age');
user.toObject(false).should.have.property('age', 20); user.toObject(false).should.have.property('age', 20);
}); });
it('updates instances with unknown properties in non-strict mode', function(done) { it('updates instances with unknown properties in non-strict mode', function(done) {
@ -603,7 +596,6 @@ describe('DataSource define model', function() {
done(); done();
}); });
}); });
}); });
}); });
@ -658,7 +650,6 @@ describe('DataSource define model', function() {
}); });
User.http.path.should.equal('/accounts'); User.http.path.should.equal('/accounts');
}); });
}); });
describe('Model loaded with a base', function() { describe('Model loaded with a base', function() {
@ -858,7 +849,6 @@ describe('Models attached to a dataSource', function() {
done(); done();
}); });
}); });
}); });
}); });
@ -1179,7 +1169,6 @@ describe('Model define with relations configuration', function() {
} catch (e) { } catch (e) {
done(); done();
} }
}); });
it('throws an error if a relation type is invalid', function(done) { it('throws an error if a relation type is invalid', function(done) {
@ -1194,7 +1183,6 @@ describe('Model define with relations configuration', function() {
} catch (e) { } catch (e) {
done(); done();
} }
}); });
it('sets up hasMany through relations', function(done) { it('sets up hasMany through relations', function(done) {
@ -1283,7 +1271,6 @@ describe('Model define with relations configuration', function() {
assert(User.relations['posts']); assert(User.relations['posts']);
done(); done();
}); });
}); });
describe('Model define with scopes configuration', function() { describe('Model define with scopes configuration', function() {
@ -1403,7 +1390,6 @@ describe('DataAccessObject', function() {
where = model._coerce({vip: ''}); where = model._coerce({vip: ''});
assert.deepEqual(where, {vip: false}); assert.deepEqual(where, {vip: false});
}); });
it('coerces where clause with and operators', function() { it('coerces where clause with and operators', function() {
@ -1619,7 +1605,6 @@ describe('DataAccessObject', function() {
ds.settings.test = 'willNotGet'; ds.settings.test = 'willNotGet';
assert.notEqual(model._getSetting('test'), ds.settings.test, 'Should not get datasource setting'); assert.notEqual(model._getSetting('test'), ds.settings.test, 'Should not get datasource setting');
}); });
}); });
describe('ModelBuilder processing json files', function() { describe('ModelBuilder processing json files', function() {
@ -1647,7 +1632,6 @@ describe('ModelBuilder processing json files', function() {
} }
it('defines models', function() { it('defines models', function() {
var models = loadSchemasSync(path.join(__dirname, 'test1-schemas.json')); var models = loadSchemasSync(path.join(__dirname, 'test1-schemas.json'));
models.should.have.property('AnonymousModel_0'); models.should.have.property('AnonymousModel_0');

View File

@ -16,7 +16,6 @@ var ValidationError = require('..').ValidationError;
var UUID_REGEXP = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i; var UUID_REGEXP = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
describe('manipulation', function() { describe('manipulation', function() {
before(function(done) { before(function(done) {
db = getSchema(); db = getSchema();
@ -30,7 +29,6 @@ describe('manipulation', function() {
}, {forceId: true, strict: true}); }, {forceId: true, strict: true});
db.automigrate(['Person'], done); db.automigrate(['Person'], done);
}); });
// A simplified implementation of LoopBack's User model // A simplified implementation of LoopBack's User model
@ -61,7 +59,6 @@ describe('manipulation', function() {
}); });
describe('create', function() { describe('create', function() {
before(function(done) { before(function(done) {
Person.destroyAll(done); Person.destroyAll(done);
}); });
@ -134,7 +131,6 @@ describe('manipulation', function() {
done(); done();
}) })
.catch(done); .catch(done);
}); });
it('should not return instance of object', function(done) { it('should not return instance of object', function(done) {
@ -351,7 +347,6 @@ describe('manipulation', function() {
}); });
describe('save', function() { describe('save', function() {
it('should save new object', function(done) { it('should save new object', function(done) {
var p = new Person; var p = new Person;
p.save(function(err) { p.save(function(err) {
@ -1364,7 +1359,6 @@ describe('manipulation', function() {
}); });
describe('destroy', function() { describe('destroy', function() {
it('should destroy record', function(done) { it('should destroy record', function(done) {
Person.create(function(err, p) { Person.create(function(err, p) {
if (err) return done(err); if (err) return done(err);
@ -1426,7 +1420,6 @@ describe('manipulation', function() {
}); });
}) })
.catch(done); .catch(done);
}); });
// TODO: implement destroy with filtered set // TODO: implement destroy with filtered set
@ -1789,7 +1782,6 @@ describe('manipulation', function() {
p1 = new Person({name: 'John', married: undefined}); p1 = new Person({name: 'John', married: undefined});
p1.should.have.property('married', undefined); p1.should.have.property('married', undefined);
}); });
it('should coerce date types properly', function() { it('should coerce date types properly', function() {

View File

@ -136,7 +136,6 @@ describe('Memory connector', function() {
assert.equal(users.length, 2); assert.equal(users.length, 2);
done(err); done(err);
}); });
}); });
}); });
@ -617,7 +616,6 @@ describe('Memory connector', function() {
}, },
], done); ], done);
} }
}); });
it('should use collection setting', function(done) { it('should use collection setting', function(done) {
@ -739,7 +737,6 @@ describe('Memory connector', function() {
done(); done();
}); });
}); });
}); });
describe('findOrCreate', function() { describe('findOrCreate', function() {
@ -980,7 +977,6 @@ describe('Memory connector with options', function() {
done(err); done(err);
}); });
}); });
}); });
describe('Memory connector with observers', function() { describe('Memory connector with observers', function() {

View File

@ -16,7 +16,6 @@ var modelBuilder = new ModelBuilder();
var mixins = modelBuilder.mixins; var mixins = modelBuilder.mixins;
function timestamps(Model, options) { function timestamps(Model, options) {
Model.defineProperty('createdAt', {type: Date}); Model.defineProperty('createdAt', {type: Date});
Model.defineProperty('updatedAt', {type: Date}); Model.defineProperty('updatedAt', {type: Date});
@ -47,7 +46,6 @@ function timestamps(Model, options) {
mixins.define('TimeStamp', timestamps); mixins.define('TimeStamp', timestamps);
describe('Model class', function() { describe('Model class', function() {
it('should define mixins', function() { it('should define mixins', function() {
mixins.define('Example', function(Model, options) { mixins.define('Example', function(Model, options) {
Model.prototype.example = function() { Model.prototype.example = function() {
@ -133,7 +131,6 @@ describe('Model class', function() {
}); });
describe('#mixin()', function() { describe('#mixin()', function() {
var Person, Author, Address; var Person, Author, Address;
beforeEach(function() { beforeEach(function() {
@ -161,7 +158,5 @@ describe('Model class', function() {
Author.mixin(Address); Author.mixin(Address);
Author._mixins.should.containEql(Address); Author._mixins.should.containEql(Address);
}); });
}); });
}); });

View File

@ -50,7 +50,6 @@ describe('ModelDefinition class', function() {
assert.deepEqual(User.toJSON(), json); assert.deepEqual(User.toJSON(), json);
done(); done();
}); });
it('should be able to define additional properties', function(done) { it('should be able to define additional properties', function(done) {
@ -81,7 +80,6 @@ describe('ModelDefinition class', function() {
assert.deepEqual(json.properties.id, {type: 'Number', id: true}); assert.deepEqual(json.properties.id, {type: 'Number', id: true});
done(); done();
}); });
it('should be able to define nesting models', function(done) { it('should be able to define nesting models', function(done) {
@ -123,7 +121,6 @@ describe('ModelDefinition class', function() {
state: {type: 'String'}}); state: {type: 'String'}});
done(); done();
}); });
it('should be able to define referencing models', function(done) { it('should be able to define referencing models', function(done) {
@ -164,7 +161,6 @@ describe('ModelDefinition class', function() {
assert.equal(json.properties.address.type, 'Address'); assert.equal(json.properties.address.type, 'Address');
done(); done();
}); });
it('should be able to define referencing models by name', function(done) { it('should be able to define referencing models by name', function(done) {
@ -205,7 +201,6 @@ describe('ModelDefinition class', function() {
assert.equal(json.properties.address.type, 'Address'); assert.equal(json.properties.address.type, 'Address');
done(); done();
}); });
it('should report correct id names', function(done) { it('should report correct id names', function(done) {

View File

@ -19,7 +19,6 @@ var INVALID_DATA = {name: null};
var VALID_DATA = {name: INITIAL_NAME}; var VALID_DATA = {name: INITIAL_NAME};
describe('optional-validation', function() { describe('optional-validation', function() {
before(function(done) { before(function(done) {
db = getSchema(); db = getSchema();
ModelWithForceId = db.createModel( ModelWithForceId = db.createModel(
@ -140,7 +139,6 @@ describe('optional-validation', function() {
}); });
describe('no model setting', function() { describe('no model setting', function() {
describe('method create', function() { describe('method create', function() {
it('should throw on create with validate:true with invalid data', function(done) { it('should throw on create with validate:true with invalid data', function(done) {
User.create(INVALID_DATA, {validate: true}, expectValidationError(done)); User.create(INVALID_DATA, {validate: true}, expectValidationError(done));
@ -311,11 +309,9 @@ describe('optional-validation', function() {
}); });
}); });
}); });
}); });
describe('model setting: automaticValidation: false', function() { describe('model setting: automaticValidation: false', function() {
before(function(done) { before(function(done) {
User.settings.automaticValidation = false; User.settings.automaticValidation = false;
done(); done();
@ -453,11 +449,9 @@ describe('optional-validation', function() {
}); });
}); });
}); });
}); });
describe('model setting: automaticValidation: true', function() { describe('model setting: automaticValidation: true', function() {
before(function(done) { before(function(done) {
User.settings.automaticValidation = true; User.settings.automaticValidation = true;
done(); done();
@ -594,7 +588,5 @@ describe('optional-validation', function() {
}); });
}); });
}); });
}); });
}); });

View File

@ -485,7 +485,6 @@ module.exports = function(dataSource, should, connectorCapabilities) {
}); });
done(); done();
}); });
}); });
}); });
@ -3056,7 +3055,6 @@ module.exports = function(dataSource, should, connectorCapabilities) {
done(); done();
}); });
}); });
}); });
describe('PersistedModel.upsertWithWhere', function() { describe('PersistedModel.upsertWithWhere', function() {

View File

@ -28,7 +28,6 @@ var getMemoryDataSource = function(settings) {
}; };
describe('relations', function() { describe('relations', function() {
before(function() { before(function() {
db = getSchema(); db = getSchema();
}); });
@ -67,7 +66,6 @@ describe('relations', function() {
}); });
describe('with scope', function() { describe('with scope', function() {
before(function(done) { before(function(done) {
Book.hasMany(Chapter); Book.hasMany(Chapter);
done(); done();
@ -556,7 +554,6 @@ describe('relations', function() {
}).catch(done); }).catch(done);
}); });
}); });
}); });
describe('hasMany through', function() { describe('hasMany through', function() {
@ -677,7 +674,6 @@ describe('relations', function() {
}); });
function verify(physician) { function verify(physician) {
physician.patients(function(err, ch) { physician.patients(function(err, ch) {
var patients = physician.patients(); var patients = physician.patients();
patients.should.eql(ch); patients.should.eql(ch);
@ -706,7 +702,6 @@ describe('relations', function() {
function verify(physician) { function verify(physician) {
return physician.patients.getAsync() return physician.patients.getAsync()
.then(function(ch) { .then(function(ch) {
var patients = physician.patients(); var patients = physician.patients();
patients.should.eql(ch); patients.should.eql(ch);
@ -1229,7 +1224,6 @@ describe('relations', function() {
}); });
}); });
}); });
}); });
describe('hasMany through - collect', function() { describe('hasMany through - collect', function() {
@ -1327,7 +1321,6 @@ describe('relations', function() {
}); });
describe('when custom reverse belongsTo name for one side only', function() { describe('when custom reverse belongsTo name for one side only', function() {
beforeEach(function() { beforeEach(function() {
Physician.hasMany(Patient, {as: 'xxx', through: Appointment, foreignKey: 'fooId'}); Physician.hasMany(Patient, {as: 'xxx', through: Appointment, foreignKey: 'fooId'});
Patient.hasMany(Physician, {as: 'yyy', through: Appointment, keyThrough: 'fooId'}); Patient.hasMany(Physician, {as: 'yyy', through: Appointment, keyThrough: 'fooId'});
@ -1674,7 +1667,6 @@ describe('relations', function() {
}); });
}); });
}); });
}); });
describe('polymorphic hasOne', function() { describe('polymorphic hasOne', function() {
@ -1821,7 +1813,6 @@ describe('relations', function() {
}); });
}); });
}); });
}); });
describe('polymorphic hasOne with non standard ids', function() { describe('polymorphic hasOne with non standard ids', function() {
@ -2175,7 +2166,6 @@ describe('relations', function() {
done(); done();
}); });
}); });
}); });
describe('polymorphic hasAndBelongsToMany through', function() { describe('polymorphic hasAndBelongsToMany through', function() {
@ -2475,7 +2465,6 @@ describe('relations', function() {
}); });
}); });
}); });
}); });
describe('belongsTo', function() { describe('belongsTo', function() {
@ -2685,7 +2674,6 @@ describe('relations', function() {
done(); done();
}).catch(done); }).catch(done);
}); });
}); });
describe('belongsTo with scope', function() { describe('belongsTo with scope', function() {
@ -2757,7 +2745,6 @@ describe('relations', function() {
}) })
.catch(done); .catch(done);
}); });
}); });
// Disable the tests until the issue in // Disable the tests until the issue in
@ -3043,11 +3030,9 @@ describe('relations', function() {
done(); done();
}); });
}); });
}); });
describe('hasOne with scope', function() { describe('hasOne with scope', function() {
var Supplier, Account; var Supplier, Account;
var supplierId, accountId; var supplierId, accountId;
@ -3153,7 +3138,6 @@ describe('relations', function() {
}) })
.catch(done); .catch(done);
}); });
}); });
describe('hasOne with non standard id', function() { describe('hasOne with non standard id', function() {
@ -3240,7 +3224,6 @@ describe('relations', function() {
done(); done();
}); });
}); });
}); });
describe('hasOne with primaryKey different from model PK', function() { describe('hasOne with primaryKey different from model PK', function() {
@ -3606,7 +3589,6 @@ describe('relations', function() {
}); });
describe('embedsOne', function() { describe('embedsOne', function() {
var person; var person;
var Passport; var Passport;
var Other; var Other;
@ -3945,7 +3927,6 @@ describe('relations', function() {
}); });
describe('embedsOne - persisted model', function() { describe('embedsOne - persisted model', function() {
// This test spefically uses the Memory connector // This test spefically uses the Memory connector
// in order to test the use of the auto-generated // in order to test the use of the auto-generated
// id, in the sequence of the related model. // id, in the sequence of the related model.
@ -3997,7 +3978,6 @@ describe('relations', function() {
}); });
}).catch(done); }).catch(done);
}); });
}); });
describe('embedsOne - generated id', function() { describe('embedsOne - generated id', function() {
@ -4030,11 +4010,9 @@ describe('relations', function() {
}); });
}); });
}); });
}); });
describe('embedsMany', function() { describe('embedsMany', function() {
var address1, address2; var address1, address2;
before(function(done) { before(function(done) {
@ -4268,11 +4246,9 @@ describe('relations', function() {
done(); done();
}); });
}); });
}); });
describe('embedsMany - numeric ids + forceId', function() { describe('embedsMany - numeric ids + forceId', function() {
before(function(done) { before(function(done) {
tmp = getTransientDataSource(); tmp = getTransientDataSource();
// db = getSchema(); // db = getSchema();
@ -4305,7 +4281,6 @@ describe('relations', function() {
}); });
}); });
}); });
}); });
describe('embedsMany - explicit ids', function() { describe('embedsMany - explicit ids', function() {
@ -4474,11 +4449,9 @@ describe('relations', function() {
}); });
}); });
}); });
}); });
describe('embedsMany - persisted model', function() { describe('embedsMany - persisted model', function() {
var address0, address1, address2; var address0, address1, address2;
var person; var person;
@ -4600,11 +4573,9 @@ describe('relations', function() {
}); });
}); });
}); });
}); });
describe('embedsMany - relations, scope and properties', function() { describe('embedsMany - relations, scope and properties', function() {
var category, job1, job2, job3; var category, job1, job2, job3;
before(function() { before(function() {
@ -4859,11 +4830,9 @@ describe('relations', function() {
done(); done();
}); });
}); });
}); });
describe('embedsMany - polymorphic relations', function() { describe('embedsMany - polymorphic relations', function() {
var person1, person2; var person1, person2;
before(function(done) { before(function(done) {
@ -4969,7 +4938,6 @@ describe('relations', function() {
}); });
it('should include nested related items on scope', function(done) { it('should include nested related items on scope', function(done) {
// There's some date duplication going on, so it might // There's some date duplication going on, so it might
// make sense to override toObject on a case-by-case basis // make sense to override toObject on a case-by-case basis
// to sort this out (delete links, keep people). // to sort this out (delete links, keep people).
@ -4996,11 +4964,9 @@ describe('relations', function() {
done(); done();
}); });
}); });
}); });
describe('referencesMany', function() { describe('referencesMany', function() {
var job1, job2, job3; var job1, job2, job3;
before(function(done) { before(function(done) {
@ -5642,7 +5608,5 @@ describe('relations', function() {
}) })
.catch(done); .catch(done);
}); });
}); });
}); });

View File

@ -12,7 +12,6 @@ var should = require('./init.js');
var db = getSchema(), slave = getSchema(), Model, SlaveModel; var db = getSchema(), slave = getSchema(), Model, SlaveModel;
describe('dataSource', function() { describe('dataSource', function() {
it('should define Model', function() { it('should define Model', function() {
Model = db.define('Model'); Model = db.define('Model');
Model.dataSource.should.eql(db); Model.dataSource.should.eql(db);
@ -61,5 +60,4 @@ describe('dataSource', function() {
}); });
}); });
}); });
}); });

View File

@ -12,7 +12,6 @@ var should = require('./init.js');
var db, Railway, Station; var db, Railway, Station;
describe('scope', function() { describe('scope', function() {
before(function() { before(function() {
db = getSchema(); db = getSchema();
Railway = db.define('Railway', { Railway = db.define('Railway', {
@ -106,11 +105,9 @@ describe('scope', function() {
}); });
}); });
}); });
}); });
describe('scope - order', function() { describe('scope - order', function() {
before(function() { before(function() {
db = getSchema(); db = getSchema();
Station = db.define('Station', { Station = db.define('Station', {
@ -161,11 +158,9 @@ describe('scope - order', function() {
done(); done();
}); });
}); });
}); });
describe('scope - filtered count, updateAll and destroyAll', function() { describe('scope - filtered count, updateAll and destroyAll', function() {
var stationA; var stationA;
before(function() { before(function() {
@ -332,7 +327,6 @@ describe('scope - filtered count, updateAll and destroyAll', function() {
}); });
}; };
}); });
}); });
describe('scope - dynamic target class', function() { describe('scope - dynamic target class', function() {
@ -417,11 +411,9 @@ describe('scope - dynamic target class', function() {
done(); done();
}); });
}); });
}); });
describe('scope - dynamic function', function() { describe('scope - dynamic function', function() {
var Item, seed = 0; var Item, seed = 0;
before(function() { before(function() {

View File

@ -17,7 +17,6 @@ var getTransientDataSource = function(settings) {
}; };
describe('Transient connector', function() { describe('Transient connector', function() {
before(function() { before(function() {
db = getTransientDataSource(); db = getTransientDataSource();
TransientModel = db.define('TransientModel', {}, {idInjection: false}); TransientModel = db.define('TransientModel', {}, {idInjection: false});
@ -83,5 +82,4 @@ describe('Transient connector', function() {
}); });
}); });
}); });
}); });

View File

@ -25,7 +25,6 @@ describe('util.fieldsToArray', function() {
it('Turn objects and strings into an array of fields' + it('Turn objects and strings into an array of fields' +
' to include when finding models', function() { ' to include when finding models', function() {
sample(false).expect(undefined); sample(false).expect(undefined);
sample(null).expect(undefined); sample(null).expect(undefined);
sample({}).expect(undefined); sample({}).expect(undefined);
@ -38,7 +37,6 @@ describe('util.fieldsToArray', function() {
}); });
it('should exclude unknown properties', function() { it('should exclude unknown properties', function() {
sample(false, true).expect(undefined); sample(false, true).expect(undefined);
sample(null, true).expect(undefined); sample(null, true).expect(undefined);
sample({}, true).expect(undefined); sample({}, true).expect(undefined);
@ -78,7 +76,6 @@ describe('util.removeUndefined', function() {
var q6 = {where: {x: 1, y: undefined}}; var q6 = {where: {x: 1, y: undefined}};
(function() { removeUndefined(q6, 'throw'); }).should.throw(/`undefined` in query/); (function() { removeUndefined(q6, 'throw'); }).should.throw(/`undefined` in query/);
}); });
}); });
@ -95,7 +92,6 @@ describe('util.parseSettings', function() {
should.equal(settings.connector, 'mongodb'); should.equal(settings.connector, 'mongodb');
should.equal(settings.w, '2'); should.equal(settings.w, '2');
should.equal(settings.url, 'mongodb://x:y@localhost:27017/mydb?w=2'); should.equal(settings.url, 'mongodb://x:y@localhost:27017/mydb?w=2');
}); });
it('Parse a url without auth into a settings object', function() { it('Parse a url without auth into a settings object', function() {
@ -110,7 +106,6 @@ describe('util.parseSettings', function() {
should.equal(settings.connector, 'mongodb'); should.equal(settings.connector, 'mongodb');
should.equal(settings.w, '2'); should.equal(settings.w, '2');
should.equal(settings.url, 'mongodb://localhost:27017/mydb/abc?w=2'); should.equal(settings.url, 'mongodb://localhost:27017/mydb/abc?w=2');
}); });
it('Parse a url with complex query into a settings object', function() { it('Parse a url with complex query into a settings object', function() {
@ -127,7 +122,6 @@ describe('util.parseSettings', function() {
should.equal(settings.x.b, '2'); should.equal(settings.x.b, '2');
should.equal(settings.engine, 'InnoDB'); should.equal(settings.engine, 'InnoDB');
should.equal(settings.url, 'mysql://127.0.0.1:3306/mydb?x[a]=1&x[b]=2&engine=InnoDB'); should.equal(settings.url, 'mysql://127.0.0.1:3306/mydb?x[a]=1&x[b]=2&engine=InnoDB');
}); });
it('Parse a url without auth into a settings object', function() { it('Parse a url without auth into a settings object', function() {
@ -140,9 +134,7 @@ describe('util.parseSettings', function() {
should.equal(settings.connector, 'memory'); should.equal(settings.connector, 'memory');
should.equal(settings.x, '1'); should.equal(settings.x, '1');
should.equal(settings.url, 'memory://?x=1'); should.equal(settings.url, 'memory://?x=1');
}); });
}); });
describe('mergeSettings', function() { describe('mergeSettings', function() {
@ -218,7 +210,6 @@ describe('mergeSettings', function() {
}); });
describe('sortObjectsByIds', function() { describe('sortObjectsByIds', function() {
var items = [ var items = [
{id: 1, name: 'a'}, {id: 1, name: 'a'},
{id: 2, name: 'b'}, {id: 2, name: 'b'},
@ -245,11 +236,9 @@ describe('sortObjectsByIds', function() {
var names = sorted.map(function(u) { return u.name; }); var names = sorted.map(function(u) { return u.name; });
should.deepEqual(names, ['e', 'c', 'b']); should.deepEqual(names, ['e', 'c', 'b']);
}); });
}); });
describe('util.mergeIncludes', function() { describe('util.mergeIncludes', function() {
function checkInputOutput(baseInclude, updateInclude, expectedInclude) { function checkInputOutput(baseInclude, updateInclude, expectedInclude) {
var mergedInclude = mergeIncludes(baseInclude, updateInclude); var mergedInclude = mergeIncludes(baseInclude, updateInclude);
should.deepEqual(mergedInclude, expectedInclude, should.deepEqual(mergedInclude, expectedInclude,
@ -391,7 +380,6 @@ describe('util.mergeIncludes', function() {
}); });
describe('util.uniq', function() { describe('util.uniq', function() {
it('should dedupe an array with duplicate number entries', function() { it('should dedupe an array with duplicate number entries', function() {
var a = [1, 2, 1, 3]; var a = [1, 2, 1, 3];
var b = uniq(a); var b = uniq(a);
@ -431,7 +419,6 @@ describe('util.uniq', function() {
err.should.be.instanceof(Error); err.should.be.instanceof(Error);
} }
}); });
}); });
describe('util.toRegExp', function() { describe('util.toRegExp', function() {

View File

@ -26,7 +26,6 @@ function getValidAttributes() {
} }
describe('validations', function() { describe('validations', function() {
var User, Entry; var User, Entry;
before(function(done) { before(function(done) {
@ -64,9 +63,7 @@ describe('validations', function() {
}); });
describe('commons', function() { describe('commons', function() {
describe('skipping', function() { describe('skipping', function() {
it('should NOT skip when `if` is fulfilled', function() { it('should NOT skip when `if` is fulfilled', function() {
User.validatesPresenceOf('pendingPeriod', {if: 'createdByAdmin'}); User.validatesPresenceOf('pendingPeriod', {if: 'createdByAdmin'});
var user = new User; var user = new User;
@ -106,11 +103,9 @@ describe('validations', function() {
user.pendingPeriod = 1; user.pendingPeriod = 1;
user.isValid().should.be.true; user.isValid().should.be.true;
}); });
}); });
describe('skipping in async validation', function() { describe('skipping in async validation', function() {
it('should skip when `if` is NOT fulfilled', function(done) { it('should skip when `if` is NOT fulfilled', function(done) {
User.validateAsync('pendingPeriod', function(err, done) { User.validateAsync('pendingPeriod', function(err, done) {
if (!this.pendingPeriod) err(); if (!this.pendingPeriod) err();
@ -166,11 +161,9 @@ describe('validations', function() {
done(); done();
}); });
}); });
}); });
describe('lifecycle', function() { describe('lifecycle', function() {
it('should work on create', function(done) { it('should work on create', function(done) {
delete User.validations; delete User.validations;
User.validatesPresenceOf('name'); User.validatesPresenceOf('name');
@ -351,7 +344,6 @@ describe('validations', function() {
}); });
describe('presence', function() { describe('presence', function() {
it('should validate presence', function() { it('should validate presence', function() {
User.validatesPresenceOf('name', 'email'); User.validatesPresenceOf('name', 'email');
@ -398,11 +390,9 @@ describe('validations', function() {
user.domain = 'domain'; user.domain = 'domain';
user.isValid().should.be.true; user.isValid().should.be.true;
}); });
}); });
describe('absence', function() { describe('absence', function() {
it('should validate absence', function() { it('should validate absence', function() {
User.validatesAbsenceOf('reserved', {if: 'locked'}); User.validatesAbsenceOf('reserved', {if: 'locked'});
var u = new User({reserved: 'foo', locked: true}); var u = new User({reserved: 'foo', locked: true});
@ -412,7 +402,6 @@ describe('validations', function() {
var u = new User({reserved: 'foo', locked: false}); var u = new User({reserved: 'foo', locked: false});
u.isValid().should.be.true; u.isValid().should.be.true;
}); });
}); });
describe('uniqueness', function() { describe('uniqueness', function() {