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

View File

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

View File

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

View File

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

View File

@ -54,7 +54,6 @@ var setupProducts = function(ids, done) {
};
describe('default scope', function() {
before(function(done) {
db = getSchema();
@ -136,7 +135,6 @@ describe('default scope', function() {
});
describe('manipulation', function() {
var ids = {};
before(function(done) {
@ -213,11 +211,9 @@ describe('default scope', function() {
done();
});
});
});
describe('findById', function() {
var ids = {};
before(function(done) {
@ -248,11 +244,9 @@ describe('default scope', function() {
done();
});
});
});
describe('find', function() {
var ids = {};
before(function(done) {
@ -322,11 +316,9 @@ describe('default scope', function() {
done();
});
});
});
describe('exists', function() {
var ids = {};
before(function(done) {
@ -372,11 +364,9 @@ describe('default scope', function() {
done();
});
});
});
describe('count', function() {
var ids = {};
before(function(done) {
@ -422,11 +412,9 @@ describe('default scope', function() {
done();
});
});
});
describe('removeById', function() {
var ids = {};
function isDeleted(id, done) {
@ -482,11 +470,9 @@ describe('default scope', function() {
done();
});
});
});
describe('update', function() {
var ids = {};
before(function(done) {
@ -529,11 +515,9 @@ describe('default scope', function() {
done();
});
});
});
describe('remove', function() {
var ids = {};
before(function(done) {
@ -603,11 +587,9 @@ describe('default scope', function() {
});
});
});
});
describe('scopes', function() {
var ids = {};
before(function(done) {
@ -643,11 +625,9 @@ describe('default scope', function() {
done();
});
});
});
describe('scope function', function() {
before(function(done) {
db.automigrate(done);
});
@ -695,11 +675,9 @@ describe('default scope', function() {
done();
});
});
});
describe('relations', function() {
var ids = {};
before(function(done) {
@ -818,11 +796,9 @@ describe('default scope', function() {
});
});
});
});
describe('with include option', function() {
before(function(done) {
db.automigrate(done);
});
@ -844,7 +820,5 @@ describe('default scope', function() {
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;
describe('GeoPoint', function() {
describe('constructor', function() {
it('should support a valid array', function() {
var point = new GeoPoint([-34, 150]);
@ -80,33 +78,26 @@ describe('GeoPoint', function() {
};
fn.should.throw();
});
});
describe('toString()', function() {
it('should return a string in the form "lat,lng"', function() {
var point = new GeoPoint({lat: -34, lng: 150});
point.toString().should.equal('-34,150');
});
});
describe('distance calculation between two points', function() {
var here = new GeoPoint({lat: 40.77492964101182, lng: -73.90950187151662});
var there = new GeoPoint({lat: 40.7753227, lng: -73.909217});
it('should return value in miles by default', function() {
var distance = GeoPoint.distanceBetween(here, there);
distance.should.be.a.Number;
distance.should.be.approximately(0.03097916611592679, DELTA);
});
it('should return value using specified unit', function() {
/* Supported units:
* - `radians`
* - `kilometers`
@ -140,7 +131,5 @@ describe('GeoPoint', function() {
distance.should.be.a.Number;
distance.should.be.approximately(0.0004483676593058972, DELTA);
});
});
});

View File

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

View File

@ -15,7 +15,6 @@ var DataSource = require('../').DataSource;
var db, User, Profile, AccessToken, Post, Passport, City, Street, Building, Assembly, Part;
describe('include', function() {
before(setup);
it('should fetch belongsTo relation', function(done) {
@ -63,7 +62,6 @@ describe('include', function() {
it('should fetch Passport - Owner - Posts', function(done) {
Passport.find({include: {owner: 'posts'}}, function(err, passports) {
should.not.exist(err);
should.exist(passports);
passports.length.should.be.ok;
@ -689,13 +687,11 @@ describe('include', function() {
// Create a part
assembly.parts.create({partNumber: 'door'}, function(err, part4) {
Assembly.find({include: 'parts'}, function(err, assemblies) {
assemblies.length.should.equal(1);
assemblies[0].parts().length.should.equal(2);
done();
});
});
});
});
@ -1082,7 +1078,6 @@ function setup(done) {
}
);
}
});
}
@ -1164,7 +1159,6 @@ describe('Model instance with included relation .toJSON()', function() {
function(err) {
done(err);
});
});
function createChallengers(callback) {
@ -1188,7 +1182,6 @@ describe('Model instance with included relation .toJSON()', function() {
it('should recursively serialize objects', function(done) {
var filter = {include: {gameParticipations: 'results'}};
ChallengerModel.find(filter, function(err, challengers) {
var levelOneInclusion = challengers[0].toJSON().gameParticipations[0];
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() {
it('should handle simple types', function() {
assert.equal(introspectType('123'), 'string');
assert.equal(introspectType(true), 'boolean');
@ -130,6 +129,5 @@ describe('Introspection of model definitions from JSON', function() {
assert.deepEqual(obj, copy);
done();
});
});

View File

@ -14,7 +14,6 @@ var ModelBuilder = jdb.ModelBuilder;
var DataSource = jdb.DataSource;
describe('ModelBuilder', function() {
it('supports plain models', function(done) {
var modelBuilder = new ModelBuilder();
@ -261,7 +260,6 @@ describe('ModelBuilder', function() {
follow.should.have.property('id');
assert.deepEqual(follow.id, {followerId: 1, followeeId: 2});
});
});
describe('DataSource ping', function() {
@ -399,7 +397,6 @@ describe('DataSource define model', function() {
Color.all(function(err, colors) {
colors.should.have.lengthOf(3);
});
});
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});
User.create({name: 'Joe', age: 20}, function(err, user) {
User.modelName.should.equal('User');
user.should.be.type('object');
assert(user.name === 'Joe');
@ -480,7 +476,6 @@ describe('DataSource define model', function() {
User.modelName.should.equal('User');
User.create({name: 'Joe', age: 20}, function(err, user) {
user.should.be.type('object').and.have.property('name', 'Joe');
user.should.have.property('name', 'Joe');
user.should.have.property('age', 20);
@ -502,7 +497,6 @@ describe('DataSource define model', function() {
var User = ds.define('User', {});
User.create({name: 'Joe', age: 20}, function(err, user) {
User.modelName.should.equal('User');
user.should.be.type('object').and.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(true).should.not.have.property('age');
user.toObject(false).should.have.property('age', 20);
});
it('updates instances with unknown properties in non-strict mode', function(done) {
@ -603,7 +596,6 @@ describe('DataSource define model', function() {
done();
});
});
});
});
@ -658,7 +650,6 @@ describe('DataSource define model', function() {
});
User.http.path.should.equal('/accounts');
});
});
describe('Model loaded with a base', function() {
@ -858,7 +849,6 @@ describe('Models attached to a dataSource', function() {
done();
});
});
});
});
@ -1179,7 +1169,6 @@ describe('Model define with relations configuration', function() {
} catch (e) {
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) {
done();
}
});
it('sets up hasMany through relations', function(done) {
@ -1283,7 +1271,6 @@ describe('Model define with relations configuration', function() {
assert(User.relations['posts']);
done();
});
});
describe('Model define with scopes configuration', function() {
@ -1403,7 +1390,6 @@ describe('DataAccessObject', function() {
where = model._coerce({vip: ''});
assert.deepEqual(where, {vip: false});
});
it('coerces where clause with and operators', function() {
@ -1619,7 +1605,6 @@ describe('DataAccessObject', function() {
ds.settings.test = 'willNotGet';
assert.notEqual(model._getSetting('test'), ds.settings.test, 'Should not get datasource setting');
});
});
describe('ModelBuilder processing json files', function() {
@ -1647,7 +1632,6 @@ describe('ModelBuilder processing json files', function() {
}
it('defines models', function() {
var models = loadSchemasSync(path.join(__dirname, 'test1-schemas.json'));
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;
describe('manipulation', function() {
before(function(done) {
db = getSchema();
@ -30,7 +29,6 @@ describe('manipulation', function() {
}, {forceId: true, strict: true});
db.automigrate(['Person'], done);
});
// A simplified implementation of LoopBack's User model
@ -61,7 +59,6 @@ describe('manipulation', function() {
});
describe('create', function() {
before(function(done) {
Person.destroyAll(done);
});
@ -134,7 +131,6 @@ describe('manipulation', function() {
done();
})
.catch(done);
});
it('should not return instance of object', function(done) {
@ -351,7 +347,6 @@ describe('manipulation', function() {
});
describe('save', function() {
it('should save new object', function(done) {
var p = new Person;
p.save(function(err) {
@ -1364,7 +1359,6 @@ describe('manipulation', function() {
});
describe('destroy', function() {
it('should destroy record', function(done) {
Person.create(function(err, p) {
if (err) return done(err);
@ -1426,7 +1420,6 @@ describe('manipulation', function() {
});
})
.catch(done);
});
// TODO: implement destroy with filtered set
@ -1789,7 +1782,6 @@ describe('manipulation', function() {
p1 = new Person({name: 'John', married: undefined});
p1.should.have.property('married', undefined);
});
it('should coerce date types properly', function() {

View File

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

View File

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

View File

@ -50,7 +50,6 @@ describe('ModelDefinition class', function() {
assert.deepEqual(User.toJSON(), json);
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});
done();
});
it('should be able to define nesting models', function(done) {
@ -123,7 +121,6 @@ describe('ModelDefinition class', function() {
state: {type: 'String'}});
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');
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');
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};
describe('optional-validation', function() {
before(function(done) {
db = getSchema();
ModelWithForceId = db.createModel(
@ -140,7 +139,6 @@ describe('optional-validation', function() {
});
describe('no model setting', function() {
describe('method create', function() {
it('should throw on create with validate:true with invalid data', function(done) {
User.create(INVALID_DATA, {validate: true}, expectValidationError(done));
@ -311,11 +309,9 @@ describe('optional-validation', function() {
});
});
});
});
describe('model setting: automaticValidation: false', function() {
before(function(done) {
User.settings.automaticValidation = false;
done();
@ -453,11 +449,9 @@ describe('optional-validation', function() {
});
});
});
});
describe('model setting: automaticValidation: true', function() {
before(function(done) {
User.settings.automaticValidation = true;
done();
@ -594,7 +588,5 @@ describe('optional-validation', function() {
});
});
});
});
});

View File

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

View File

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

View File

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

View File

@ -17,7 +17,6 @@ var getTransientDataSource = function(settings) {
};
describe('Transient connector', function() {
before(function() {
db = getTransientDataSource();
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' +
' to include when finding models', function() {
sample(false).expect(undefined);
sample(null).expect(undefined);
sample({}).expect(undefined);
@ -38,7 +37,6 @@ describe('util.fieldsToArray', function() {
});
it('should exclude unknown properties', function() {
sample(false, true).expect(undefined);
sample(null, true).expect(undefined);
sample({}, true).expect(undefined);
@ -78,7 +76,6 @@ describe('util.removeUndefined', function() {
var q6 = {where: {x: 1, y: undefined}};
(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.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() {
@ -110,7 +106,6 @@ describe('util.parseSettings', function() {
should.equal(settings.connector, 'mongodb');
should.equal(settings.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() {
@ -127,7 +122,6 @@ describe('util.parseSettings', function() {
should.equal(settings.x.b, '2');
should.equal(settings.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() {
@ -140,9 +134,7 @@ describe('util.parseSettings', function() {
should.equal(settings.connector, 'memory');
should.equal(settings.x, '1');
should.equal(settings.url, 'memory://?x=1');
});
});
describe('mergeSettings', function() {
@ -218,7 +210,6 @@ describe('mergeSettings', function() {
});
describe('sortObjectsByIds', function() {
var items = [
{id: 1, name: 'a'},
{id: 2, name: 'b'},
@ -245,11 +236,9 @@ describe('sortObjectsByIds', function() {
var names = sorted.map(function(u) { return u.name; });
should.deepEqual(names, ['e', 'c', 'b']);
});
});
describe('util.mergeIncludes', function() {
function checkInputOutput(baseInclude, updateInclude, expectedInclude) {
var mergedInclude = mergeIncludes(baseInclude, updateInclude);
should.deepEqual(mergedInclude, expectedInclude,
@ -391,7 +380,6 @@ describe('util.mergeIncludes', function() {
});
describe('util.uniq', function() {
it('should dedupe an array with duplicate number entries', function() {
var a = [1, 2, 1, 3];
var b = uniq(a);
@ -431,7 +419,6 @@ describe('util.uniq', function() {
err.should.be.instanceof(Error);
}
});
});
describe('util.toRegExp', function() {

View File

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