From 3baa61590ee7571d3e08afaf2228ac21977093d5 Mon Sep 17 00:00:00 2001 From: Siddhi Pai Date: Tue, 13 Dec 2016 16:05:50 -0800 Subject: [PATCH] Fix block padding * Remove test/.eslintrc * run eslint . --fix --- test/.eslintrc | 7 ------- test/basic-querying.test.js | 13 ------------ test/common_test.js | 13 ------------ test/crud-with-options.test.js | 21 ------------------- test/datatype.test.js | 3 --- test/default-scope.test.js | 26 ----------------------- test/defaults.test.js | 1 - test/geo.test.js | 11 ---------- test/hooks.test.js | 8 ------- test/include.test.js | 7 ------- test/introspection.test.js | 2 -- test/loopback-dl.test.js | 16 -------------- test/manipulation.test.js | 8 ------- test/memory.test.js | 4 ---- test/mixins.test.js | 5 ----- test/model-definition.test.js | 5 ----- test/optional-validation.test.js | 8 ------- test/persistence-hooks.suite.js | 2 -- test/relations.test.js | 36 -------------------------------- test/schema.test.js | 2 -- test/scope.test.js | 8 ------- test/transient.test.js | 2 -- test/util.test.js | 13 ------------ test/validations.test.js | 11 ---------- 24 files changed, 232 deletions(-) delete mode 100644 test/.eslintrc diff --git a/test/.eslintrc b/test/.eslintrc deleted file mode 100644 index f279c3ba..00000000 --- a/test/.eslintrc +++ /dev/null @@ -1,7 +0,0 @@ -{ - "rules": { - // NOTE(bajtos) We should eventually get rid of this override, - // and fix those 200+ violations instead - "padded-blocks": "off" - } -} diff --git a/test/basic-querying.test.js b/test/basic-querying.test.js index 447e550c..e767692b 100644 --- a/test/basic-querying.test.js +++ b/test/basic-querying.test.js @@ -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) { diff --git a/test/common_test.js b/test/common_test.js index cf944879..4aa14ea5 100644 --- a/test/common_test.js +++ b/test/common_test.js @@ -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) { }); }); }); - } diff --git a/test/crud-with-options.test.js b/test/crud-with-options.test.js index 3971b19d..53cffe89 100644 --- a/test/crud-with-options.test.js +++ b/test/crud-with-options.test.js @@ -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() { diff --git a/test/datatype.test.js b/test/datatype.test.js index ecfbac14..ae8f422d 100644 --- a/test/datatype.test.js +++ b/test/datatype.test.js @@ -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); diff --git a/test/default-scope.test.js b/test/default-scope.test.js index d6924fa7..6dc984da 100644 --- a/test/default-scope.test.js +++ b/test/default-scope.test.js @@ -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(); }); }); - }); - }); diff --git a/test/defaults.test.js b/test/defaults.test.js index dab99ef7..237c1b4d 100644 --- a/test/defaults.test.js +++ b/test/defaults.test.js @@ -76,5 +76,4 @@ describe('defaults', function() { }); }); }); - }); diff --git a/test/geo.test.js b/test/geo.test.js index 3a1160ca..40c1dac8 100644 --- a/test/geo.test.js +++ b/test/geo.test.js @@ -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); }); - }); - }); diff --git a/test/hooks.test.js b/test/hooks.test.js index 8c49b884..98352320 100644 --- a/test/hooks.test.js +++ b/test/hooks.test.js @@ -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(); }); }); - }); }); diff --git a/test/include.test.js b/test/include.test.js index 50688963..8b59bf89 100644 --- a/test/include.test.js +++ b/test/include.test.js @@ -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.'); diff --git a/test/introspection.test.js b/test/introspection.test.js index 54b76db6..d5c596ba 100644 --- a/test/introspection.test.js +++ b/test/introspection.test.js @@ -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(); }); - }); diff --git a/test/loopback-dl.test.js b/test/loopback-dl.test.js index 877cf08b..56659173 100644 --- a/test/loopback-dl.test.js +++ b/test/loopback-dl.test.js @@ -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'); diff --git a/test/manipulation.test.js b/test/manipulation.test.js index 8d8d5fb8..73e13e10 100644 --- a/test/manipulation.test.js +++ b/test/manipulation.test.js @@ -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() { diff --git a/test/memory.test.js b/test/memory.test.js index 991159d4..3fd69bc5 100644 --- a/test/memory.test.js +++ b/test/memory.test.js @@ -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() { diff --git a/test/mixins.test.js b/test/mixins.test.js index e3f028aa..e0a8a0ff 100644 --- a/test/mixins.test.js +++ b/test/mixins.test.js @@ -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); }); - }); - }); diff --git a/test/model-definition.test.js b/test/model-definition.test.js index 535c5f64..6713066b 100644 --- a/test/model-definition.test.js +++ b/test/model-definition.test.js @@ -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) { diff --git a/test/optional-validation.test.js b/test/optional-validation.test.js index 8e1bd187..95ac6f71 100644 --- a/test/optional-validation.test.js +++ b/test/optional-validation.test.js @@ -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() { }); }); }); - }); - }); diff --git a/test/persistence-hooks.suite.js b/test/persistence-hooks.suite.js index c0e1dd7f..62207e7d 100644 --- a/test/persistence-hooks.suite.js +++ b/test/persistence-hooks.suite.js @@ -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() { diff --git a/test/relations.test.js b/test/relations.test.js index a8fd73fa..5ef7fdd1 100644 --- a/test/relations.test.js +++ b/test/relations.test.js @@ -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); }); - }); - }); diff --git a/test/schema.test.js b/test/schema.test.js index 6177d91f..3dd9ace4 100644 --- a/test/schema.test.js +++ b/test/schema.test.js @@ -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() { }); }); }); - }); diff --git a/test/scope.test.js b/test/scope.test.js index 9eb5d501..06158953 100644 --- a/test/scope.test.js +++ b/test/scope.test.js @@ -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() { diff --git a/test/transient.test.js b/test/transient.test.js index 92dd3ed2..4aaf84e2 100644 --- a/test/transient.test.js +++ b/test/transient.test.js @@ -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() { }); }); }); - }); diff --git a/test/util.test.js b/test/util.test.js index a8c8f8d1..246025f4 100644 --- a/test/util.test.js +++ b/test/util.test.js @@ -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() { diff --git a/test/validations.test.js b/test/validations.test.js index 90d362e2..67083004 100644 --- a/test/validations.test.js +++ b/test/validations.test.js @@ -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() {