From aec678d252ebbc724ebbc84659cc2e933bcf1fc6 Mon Sep 17 00:00:00 2001 From: Amir Jafarian Date: Mon, 22 Aug 2016 15:55:22 -0400 Subject: [PATCH] Fix manually --- .eslintrc | 4 +++- examples/app-noschema.js | 2 ++ examples/app.js | 2 ++ examples/datasource-app.js | 2 ++ examples/inclusion.js | 2 ++ examples/load-schemas.js | 2 ++ examples/nesting-schema.js | 2 ++ examples/relations.js | 2 ++ index.js | 1 + lib/browser.depd.js | 2 ++ lib/connectors/memory.js | 2 ++ lib/connectors/transient.js | 2 ++ lib/datasource.js | 2 ++ lib/geo.js | 2 ++ lib/hooks.js | 2 ++ lib/include.js | 2 ++ lib/include_utils.js | 2 ++ lib/introspection.js | 2 ++ lib/jutil.js | 2 ++ lib/list.js | 2 ++ lib/mixins.js | 1 + lib/model-builder.js | 1 + lib/model-definition.js | 1 + lib/observer.js | 1 + lib/relations.js | 1 + lib/scope.js | 1 + lib/transaction.js | 1 + lib/types.js | 1 + lib/utils.js | 1 + lib/validations.js | 2 ++ support/describe-operation-hooks.js | 2 ++ test/CustomTypeForeignKey.test.js | 1 + test/async-observer.test.js | 1 + test/basic-querying.test.js | 2 ++ test/common.batch.js | 2 ++ test/common_test.js | 2 ++ test/crud-with-options.test.js | 2 ++ test/datasource.test.js | 2 ++ test/datatype.test.js | 4 +++- test/default-scope.test.js | 2 ++ test/defaults.test.js | 2 ++ test/discovery.test.js | 12 +++++++----- test/geo.test.js | 2 ++ test/helpers/context-test-helpers.js | 1 + test/helpers/hook-monitor.js | 1 + test/helpers/uid-generator.js | 2 ++ test/hooks.test.js | 2 ++ test/include.test.js | 14 ++++++++------ test/include_util.test.js | 1 + test/init.js | 1 + test/introspection.test.js | 1 + test/json.test.js | 1 + test/kv-memory.js | 1 + test/loopback-data.test.js | 1 + test/loopback-dl.test.js | 4 +++- test/manipulation.test.js | 6 +++++- test/memory.test.js | 1 + test/mixins.test.js | 1 + test/mock-connectors.js | 1 + test/model-definition.test.js | 1 + .../embeds-many-create.suite.js | 2 ++ .../embeds-many-destroy.suite.js | 4 +++- .../embeds-many-update-by-id.suite.js | 2 ++ .../embeds-one-create.suite.js | 2 ++ .../embeds-one-destroy.suite.js | 4 +++- .../embeds-one-update.suite.js | 2 ++ test/operation-hooks.suite/index.js | 2 ++ test/optional-validation.test.js | 1 + test/persistence-hooks.suite.js | 1 + test/relations.test.js | 5 +++-- test/schema.test.js | 1 + test/scope.test.js | 1 + test/spec_helper.js | 2 ++ test/transient.test.js | 1 + test/util.test.js | 1 + test/validations.test.js | 1 + 76 files changed, 141 insertions(+), 19 deletions(-) diff --git a/.eslintrc b/.eslintrc index 9cafbbd9..d6864ff9 100644 --- a/.eslintrc +++ b/.eslintrc @@ -8,6 +8,8 @@ }], // NOTE(bajtos) we should eventually remove this override // and fix all of those 100+ violations - "one-var": "off" + "one-var": "off", + "no-unused-expressions": "off", + "strict": ["warn", "global"] } } diff --git a/examples/app-noschema.js b/examples/app-noschema.js index 0d9d4e92..e1027d90 100644 --- a/examples/app-noschema.js +++ b/examples/app-noschema.js @@ -3,6 +3,8 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +'use strict'; + var DataSource = require('../../loopback-datasource-juggler').DataSource; var ModelBuilder = require('../../loopback-datasource-juggler').ModelBuilder; var introspectType = require('../lib/introspection')(ModelBuilder); diff --git a/examples/app.js b/examples/app.js index 8f0bf98f..ef6bb722 100644 --- a/examples/app.js +++ b/examples/app.js @@ -3,6 +3,8 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +'use strict'; + var ModelBuilder = require('../../loopback-datasource-juggler').ModelBuilder; var modelBuilder = new ModelBuilder(); // define models diff --git a/examples/datasource-app.js b/examples/datasource-app.js index 5e60173a..cf976de6 100644 --- a/examples/datasource-app.js +++ b/examples/datasource-app.js @@ -3,6 +3,8 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +'use strict'; + var DataSource = require('../../loopback-datasource-juggler').DataSource; var ModelBuilder = require('../../loopback-datasource-juggler').ModelBuilder; var ds = new DataSource('memory'); diff --git a/examples/inclusion.js b/examples/inclusion.js index f51a362d..acd149bc 100644 --- a/examples/inclusion.js +++ b/examples/inclusion.js @@ -3,6 +3,8 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +'use strict'; + var jdb = require('../index'); var User, Post, Passport, City, Street, Building; diff --git a/examples/load-schemas.js b/examples/load-schemas.js index 2359b00c..94be345f 100644 --- a/examples/load-schemas.js +++ b/examples/load-schemas.js @@ -3,6 +3,8 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +'use strict'; + var path = require('path'), fs = require('fs'), DataSource = require('../lib/datasource').DataSource; diff --git a/examples/nesting-schema.js b/examples/nesting-schema.js index d86ebdb4..db99a503 100644 --- a/examples/nesting-schema.js +++ b/examples/nesting-schema.js @@ -3,6 +3,8 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +'use strict'; + var ModelBuilder = require('../../loopback-datasource-juggler').ModelBuilder; var modelBuilder = new ModelBuilder(); diff --git a/examples/relations.js b/examples/relations.js index 7b22f999..f3c68cbd 100644 --- a/examples/relations.js +++ b/examples/relations.js @@ -3,6 +3,8 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +'use strict'; + var DataSource = require('../index').DataSource; var ds = new DataSource('memory'); diff --git a/index.js b/index.js index bdb84fb0..18e9e292 100644 --- a/index.js +++ b/index.js @@ -2,6 +2,7 @@ // Node module: loopback-datasource-juggler // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +'use strict'; var SG = require('strong-globalize'); SG.SetRootDir(__dirname); diff --git a/lib/browser.depd.js b/lib/browser.depd.js index 6148c600..b8c29967 100644 --- a/lib/browser.depd.js +++ b/lib/browser.depd.js @@ -3,6 +3,8 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +'use strict'; + // A lightweight alternative to "depd" that works in the browser module.exports = function depd(namespace) { var warned = {}; diff --git a/lib/connectors/memory.js b/lib/connectors/memory.js index 109057dd..87102e3d 100644 --- a/lib/connectors/memory.js +++ b/lib/connectors/memory.js @@ -3,6 +3,8 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +'use strict'; + var g = require('strong-globalize')(); var util = require('util'); var Connector = require('loopback-connector').Connector; diff --git a/lib/connectors/transient.js b/lib/connectors/transient.js index 19a5cd9f..29afc39d 100644 --- a/lib/connectors/transient.js +++ b/lib/connectors/transient.js @@ -3,6 +3,8 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +'use strict'; + var g = require('strong-globalize')(); var util = require('util'); var Connector = require('loopback-connector').Connector; diff --git a/lib/datasource.js b/lib/datasource.js index 08366d43..53a882b8 100644 --- a/lib/datasource.js +++ b/lib/datasource.js @@ -3,6 +3,8 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +'use strict'; + /*! * Module dependencies */ diff --git a/lib/geo.js b/lib/geo.js index 9a74e300..022b4942 100644 --- a/lib/geo.js +++ b/lib/geo.js @@ -3,6 +3,8 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +'use strict'; + var assert = require('assert'); /*! diff --git a/lib/hooks.js b/lib/hooks.js index 1d809870..f3c45550 100644 --- a/lib/hooks.js +++ b/lib/hooks.js @@ -3,6 +3,8 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +'use strict'; + var deprecated = require('depd')('loopback-datasource-juggler'); var g = require('strong-globalize')(); diff --git a/lib/include.js b/lib/include.js index 3b4f1877..d36d4976 100644 --- a/lib/include.js +++ b/lib/include.js @@ -3,6 +3,8 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +'use strict'; + var async = require('async'); var g = require('strong-globalize')(); var utils = require('./utils'); diff --git a/lib/include_utils.js b/lib/include_utils.js index 2a65cacf..536e6258 100644 --- a/lib/include_utils.js +++ b/lib/include_utils.js @@ -3,6 +3,8 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +'use strict'; + module.exports.buildOneToOneIdentityMapWithOrigKeys = buildOneToOneIdentityMapWithOrigKeys; module.exports.buildOneToManyIdentityMapWithOrigKeys = buildOneToManyIdentityMapWithOrigKeys; module.exports.join = join; diff --git a/lib/introspection.js b/lib/introspection.js index ce1a9c82..305f8f1d 100644 --- a/lib/introspection.js +++ b/lib/introspection.js @@ -3,6 +3,8 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +'use strict'; + module.exports = function getIntrospector(ModelBuilder) { function introspectType(value) { // Unknown type, using Any diff --git a/lib/jutil.js b/lib/jutil.js index 128d6d16..a2650dbc 100644 --- a/lib/jutil.js +++ b/lib/jutil.js @@ -3,6 +3,8 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +'use strict'; + var util = require('util'); /** diff --git a/lib/list.js b/lib/list.js index 9800a319..1851bb4a 100644 --- a/lib/list.js +++ b/lib/list.js @@ -3,6 +3,8 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +'use strict'; + var g = require('strong-globalize')(); var util = require('util'); var Any = require('./types').Types.Any; diff --git a/lib/mixins.js b/lib/mixins.js index 3259ccb6..9cff802a 100644 --- a/lib/mixins.js +++ b/lib/mixins.js @@ -2,6 +2,7 @@ // Node module: loopback-datasource-juggler // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +'use strict'; var debug = require('debug')('loopback:mixin'); var assert = require('assert'); diff --git a/lib/model-builder.js b/lib/model-builder.js index 219ca00f..218dad7c 100644 --- a/lib/model-builder.js +++ b/lib/model-builder.js @@ -2,6 +2,7 @@ // Node module: loopback-datasource-juggler // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +'use strict'; /*! * Module dependencies diff --git a/lib/model-definition.js b/lib/model-definition.js index 216f3c9f..280caa54 100644 --- a/lib/model-definition.js +++ b/lib/model-definition.js @@ -2,6 +2,7 @@ // Node module: loopback-datasource-juggler // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +'use strict'; var assert = require('assert'); var util = require('util'); diff --git a/lib/observer.js b/lib/observer.js index f2046eb4..3e493e28 100644 --- a/lib/observer.js +++ b/lib/observer.js @@ -2,6 +2,7 @@ // Node module: loopback-datasource-juggler // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +'use strict'; var async = require('async'); var utils = require('./utils'); diff --git a/lib/relations.js b/lib/relations.js index b4a2c8b5..c7145c1a 100644 --- a/lib/relations.js +++ b/lib/relations.js @@ -2,6 +2,7 @@ // Node module: loopback-datasource-juggler // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +'use strict'; /*! * Dependencies diff --git a/lib/scope.js b/lib/scope.js index 43b0ddce..f5ca6e34 100644 --- a/lib/scope.js +++ b/lib/scope.js @@ -2,6 +2,7 @@ // Node module: loopback-datasource-juggler // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +'use strict'; var i8n = require('inflection'); var utils = require('./utils'); diff --git a/lib/transaction.js b/lib/transaction.js index db8312f9..97e535d0 100644 --- a/lib/transaction.js +++ b/lib/transaction.js @@ -2,6 +2,7 @@ // Node module: loopback-datasource-juggler // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +'use strict'; var g = require('strong-globalize')(); var debug = require('debug')('loopback:connector:transaction'); diff --git a/lib/types.js b/lib/types.js index c0829a5d..12140386 100644 --- a/lib/types.js +++ b/lib/types.js @@ -2,6 +2,7 @@ // Node module: loopback-datasource-juggler // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +'use strict'; var Types = {}; /** diff --git a/lib/utils.js b/lib/utils.js index 0160ed33..0c774bd8 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -2,6 +2,7 @@ // Node module: loopback-datasource-juggler // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +'use strict'; exports.safeRequire = safeRequire; exports.fieldsToArray = fieldsToArray; diff --git a/lib/validations.js b/lib/validations.js index 60d82557..4397743b 100644 --- a/lib/validations.js +++ b/lib/validations.js @@ -3,6 +3,8 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +'use strict'; + var g = require('strong-globalize')(); var util = require('util'); var extend = util._extend; diff --git a/support/describe-operation-hooks.js b/support/describe-operation-hooks.js index 65d4b17c..20aa8119 100644 --- a/support/describe-operation-hooks.js +++ b/support/describe-operation-hooks.js @@ -3,6 +3,8 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +'use strict'; + /* * Describe context objects of operation hooks in comprehensive HTML table. * Usage: diff --git a/test/CustomTypeForeignKey.test.js b/test/CustomTypeForeignKey.test.js index 0165dce1..62d1dcf0 100644 --- a/test/CustomTypeForeignKey.test.js +++ b/test/CustomTypeForeignKey.test.js @@ -2,6 +2,7 @@ // Node module: loopback-datasource-juggler // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +'use strict'; var should = require('./init.js'); diff --git a/test/async-observer.test.js b/test/async-observer.test.js index 2f1a22e4..b8edff0d 100644 --- a/test/async-observer.test.js +++ b/test/async-observer.test.js @@ -2,6 +2,7 @@ // Node module: loopback-datasource-juggler // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +'use strict'; var ModelBuilder = require('../').ModelBuilder; var should = require('./init'); diff --git a/test/basic-querying.test.js b/test/basic-querying.test.js index 1de66cbf..f73c0d6f 100644 --- a/test/basic-querying.test.js +++ b/test/basic-querying.test.js @@ -4,6 +4,8 @@ // License text available at https://opensource.org/licenses/MIT // This test written in mocha+should.js +'use strict'; + var should = require('./init.js'); var async = require('async'); var db, User; diff --git a/test/common.batch.js b/test/common.batch.js index 0e5c69c2..e78c41f8 100644 --- a/test/common.batch.js +++ b/test/common.batch.js @@ -3,6 +3,8 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +'use strict'; + require('./datatype.test.js'); require('./basic-querying.test.js'); require('./manipulation.test.js'); diff --git a/test/common_test.js b/test/common_test.js index 88999326..cf944879 100644 --- a/test/common_test.js +++ b/test/common_test.js @@ -3,6 +3,8 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +'use strict'; + var Schema = require('../index').Schema; var Text = Schema.Text; diff --git a/test/crud-with-options.test.js b/test/crud-with-options.test.js index bec88df1..44ff3e84 100644 --- a/test/crud-with-options.test.js +++ b/test/crud-with-options.test.js @@ -4,6 +4,8 @@ // License text available at https://opensource.org/licenses/MIT // This test written in mocha+should.js +'use strict'; + var should = require('./init.js'); var async = require('async'); var db, User, options, filter; diff --git a/test/datasource.test.js b/test/datasource.test.js index 802c422e..55a92ce9 100644 --- a/test/datasource.test.js +++ b/test/datasource.test.js @@ -3,6 +3,8 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +'use strict'; + var should = require('./init.js'); var DataSource = require('../lib/datasource.js').DataSource; diff --git a/test/datatype.test.js b/test/datatype.test.js index 49b67ef4..bbc58aae 100644 --- a/test/datatype.test.js +++ b/test/datatype.test.js @@ -4,6 +4,8 @@ // License text available at https://opensource.org/licenses/MIT // This test written in mocha+should.js +'use strict'; + var should = require('./init.js'); var db, Model; @@ -12,7 +14,7 @@ describe('datatypes', function() { before(function(done) { db = getSchema(); - Nested = db.define('Nested', {}); + var Nested = db.define('Nested', {}); Model = db.define('Model', { str: String, diff --git a/test/default-scope.test.js b/test/default-scope.test.js index e5b062f8..f48cd9c6 100644 --- a/test/default-scope.test.js +++ b/test/default-scope.test.js @@ -4,6 +4,8 @@ // License text available at https://opensource.org/licenses/MIT // This test written in mocha+should.js +'use strict'; + var should = require('./init.js'); var async = require('async'); diff --git a/test/defaults.test.js b/test/defaults.test.js index 3fa835be..b63bdb2c 100644 --- a/test/defaults.test.js +++ b/test/defaults.test.js @@ -4,6 +4,8 @@ // License text available at https://opensource.org/licenses/MIT // This test written in mocha+should.js +'use strict'; + var should = require('./init.js'); var db = getSchema(); diff --git a/test/discovery.test.js b/test/discovery.test.js index f27e4f28..1a1b8409 100644 --- a/test/discovery.test.js +++ b/test/discovery.test.js @@ -3,6 +3,8 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +'use strict'; + var jdb = require('../'); var DataSource = jdb.DataSource; var should = require('./init.js'); @@ -436,7 +438,7 @@ describe('discoverModelProperties', function() { describe('discoverPrimaryKeys', function() { var ds; - var modelProperties; + var modelProperties, primaryKeys; before(function() { ds = new DataSource({connector: 'memory'}); @@ -496,7 +498,7 @@ describe('discoverPrimaryKeys', function() { describe('discoverForeignKeys', function() { var ds; - var modelProperties; + var modelProperties, foreignKeys; before(function() { ds = new DataSource({connector: 'memory'}); @@ -553,7 +555,7 @@ describe('discoverForeignKeys', function() { describe('discoverExportedForeignKeys', function() { var ds; - var modelProperties; + var modelProperties, exportedForeignKeys; before(function() { ds = new DataSource({connector: 'memory'}); @@ -610,9 +612,9 @@ describe('discoverExportedForeignKeys', function() { }); describe('Mock connector', function() { - mockConnectors = require('./mock-connectors'); + var mockConnectors = require('./mock-connectors'); describe('customFieldSettings', function() { - ds = new DataSource(mockConnectors.customFieldSettings); + var ds = new DataSource(mockConnectors.customFieldSettings); it('should be present in discoverSchemas', function(done) { ds.discoverSchemas('person', function(err, schemas) { diff --git a/test/geo.test.js b/test/geo.test.js index 8ce9e794..3a1160ca 100644 --- a/test/geo.test.js +++ b/test/geo.test.js @@ -6,6 +6,8 @@ /*global describe,it*/ /*jshint expr:true */ +'use strict'; + require('should'); var GeoPoint = require('../lib/geo').GeoPoint; diff --git a/test/helpers/context-test-helpers.js b/test/helpers/context-test-helpers.js index cb8d0dc4..752cbb0f 100644 --- a/test/helpers/context-test-helpers.js +++ b/test/helpers/context-test-helpers.js @@ -2,6 +2,7 @@ // Node module: loopback-datasource-juggler // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +'use strict'; var traverse = require('traverse'); diff --git a/test/helpers/hook-monitor.js b/test/helpers/hook-monitor.js index 20af6cbc..0197e197 100644 --- a/test/helpers/hook-monitor.js +++ b/test/helpers/hook-monitor.js @@ -2,6 +2,7 @@ // Node module: loopback-datasource-juggler // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +'use strict'; module.exports = HookMonitor; diff --git a/test/helpers/uid-generator.js b/test/helpers/uid-generator.js index f2bc95b4..393bcaa1 100644 --- a/test/helpers/uid-generator.js +++ b/test/helpers/uid-generator.js @@ -3,6 +3,8 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +'use strict'; + var lastId = 0; exports.next = function() { diff --git a/test/hooks.test.js b/test/hooks.test.js index 952a55a8..a0de550b 100644 --- a/test/hooks.test.js +++ b/test/hooks.test.js @@ -3,6 +3,8 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +'use strict'; + // This test written in mocha+should.js var should = require('./init.js'); diff --git a/test/include.test.js b/test/include.test.js index 3c74c32d..89dbdb08 100644 --- a/test/include.test.js +++ b/test/include.test.js @@ -3,6 +3,8 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +'use strict'; + var should = require('./init.js'); var async = require('async'); var assert = require('assert'); @@ -427,7 +429,7 @@ describe('include', function() { user.name.should.equal('User A'); user.age.should.equal(21); user.id.should.equal(1); - profile = user.profile(); + var profile = user.profile(); profile.profileName.should.equal('Profile A'); profile.userId.should.equal(1); profile.id.should.equal(1); @@ -450,9 +452,9 @@ describe('include', function() { }); it('works when hasManyThrough is called', function(done) { - Physician = db.define('Physician', {name: String}); - Patient = db.define('Patient', {name: String}); - Appointment = db.define('Appointment', { + var Physician = db.define('Physician', {name: String}); + var Patient = db.define('Patient', {name: String}); + var Appointment = db.define('Appointment', { date: { type: Date, default: function() { @@ -460,7 +462,7 @@ describe('include', function() { }, }, }); - Address = db.define('Address', {name: String}); + var Address = db.define('Address', {name: String}); Physician.hasMany(Patient, {through: Appointment}); Patient.hasMany(Physician, {through: Appointment}); @@ -502,7 +504,7 @@ describe('include', function() { profile.profileName.should.equal('Profile A'); profile.userId.should.equal(1); profile.id.should.equal(1); - user = profile.user(); + var user = profile.user(); user.name.should.equal('User A'); user.age.should.equal(21); user.id.should.equal(1); diff --git a/test/include_util.test.js b/test/include_util.test.js index 99dbde0a..da4c9a3a 100644 --- a/test/include_util.test.js +++ b/test/include_util.test.js @@ -3,6 +3,7 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +'use strict'; var assert = require('assert'); var should = require('should'); diff --git a/test/init.js b/test/init.js index 96dd3396..cd2cb5c2 100644 --- a/test/init.js +++ b/test/init.js @@ -3,6 +3,7 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +'use strict'; module.exports = require('should'); /* diff --git a/test/introspection.test.js b/test/introspection.test.js index 6daad861..54b76db6 100644 --- a/test/introspection.test.js +++ b/test/introspection.test.js @@ -3,6 +3,7 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +'use strict'; var assert = require('assert'); var ModelBuilder = require('..').ModelBuilder; var DataSource = require('../').DataSource; diff --git a/test/json.test.js b/test/json.test.js index 9a8278f1..d5356185 100644 --- a/test/json.test.js +++ b/test/json.test.js @@ -4,6 +4,7 @@ // License text available at https://opensource.org/licenses/MIT // This test written in mocha+should.js +'use strict'; var should = require('./init.js'); var Schema = require('../').Schema; diff --git a/test/kv-memory.js b/test/kv-memory.js index ba40c23b..980be0f6 100644 --- a/test/kv-memory.js +++ b/test/kv-memory.js @@ -1,3 +1,4 @@ +'use strict'; var kvMemory = require('../lib/connectors/kv-memory'); var DataSource = require('..').DataSource; diff --git a/test/loopback-data.test.js b/test/loopback-data.test.js index 05e9fa22..8d175b88 100644 --- a/test/loopback-data.test.js +++ b/test/loopback-data.test.js @@ -4,6 +4,7 @@ // License text available at https://opensource.org/licenses/MIT // This test written in mocha+should.js +'use strict'; var should = require('./init.js'); var loopbackData = require('../'); diff --git a/test/loopback-dl.test.js b/test/loopback-dl.test.js index 15fb6077..07e59efe 100644 --- a/test/loopback-dl.test.js +++ b/test/loopback-dl.test.js @@ -4,6 +4,7 @@ // License text available at https://opensource.org/licenses/MIT // This test written in mocha+should.js +'use strict'; var should = require('./init.js'); var assert = require('assert'); var async = require('async'); @@ -581,6 +582,7 @@ describe('DataSource define model', function() { it('should update the instance with unknown properties', function(done) { var ds = new DataSource('memory');// define models + var Post; Post = ds.define('Post', { title: {type: String, length: 255, index: true}, content: {type: String}, @@ -1317,7 +1319,7 @@ describe('Model with scopes', function() { }); describe('DataAccessObject', function() { - var ds, model, where, error; + var ds, model, where, error, filter; before(function() { ds = new DataSource('memory'); diff --git a/test/manipulation.test.js b/test/manipulation.test.js index dd71693e..ac25c3da 100644 --- a/test/manipulation.test.js +++ b/test/manipulation.test.js @@ -4,6 +4,7 @@ // License text available at https://opensource.org/licenses/MIT // This test written in mocha+should.js +'use strict'; var async = require('async'); var should = require('./init.js'); @@ -34,6 +35,8 @@ describe('manipulation', function() { // to reproduce problems related to properties with dynamic setters // For the purpose of the tests, we use a counter instead of a hash fn. var StubUser; + var stubPasswordCounter; + before(function setupStubUserModel(done) { StubUser = db.createModel('StubUser', {password: String}, {forceId: true}); StubUser.setter.password = function(plain) { @@ -62,6 +65,7 @@ describe('manipulation', function() { }); describe('forceId', function() { + var TestForceId; before(function(done) { TestForceId = db.define('TestForceId'); db.automigrate('TestForceId', done); @@ -1253,7 +1257,7 @@ describe('manipulation', function() { }); it('fails the upsertWithWhere operation when data object is empty', function(done) { - options = {}; + var options = {}; Person.upsertWithWhere({name: 'John Lennon'}, {}, options, function(err) { err.message.should.equal('data object cannot be empty!'); diff --git a/test/memory.test.js b/test/memory.test.js index 6136f350..0bd3ba2c 100644 --- a/test/memory.test.js +++ b/test/memory.test.js @@ -3,6 +3,7 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +'use strict'; var jdb = require('../'); var DataSource = jdb.DataSource; var path = require('path'); diff --git a/test/mixins.test.js b/test/mixins.test.js index 65ef8ca3..e3f028aa 100644 --- a/test/mixins.test.js +++ b/test/mixins.test.js @@ -4,6 +4,7 @@ // License text available at https://opensource.org/licenses/MIT // This test written in mocha+should.js +'use strict'; var should = require('./init.js'); var jdb = require('../'); diff --git a/test/mock-connectors.js b/test/mock-connectors.js index 7be45427..6af4c887 100644 --- a/test/mock-connectors.js +++ b/test/mock-connectors.js @@ -3,6 +3,7 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +'use strict'; module.exports = { // connector which uses custom field settings diff --git a/test/model-definition.test.js b/test/model-definition.test.js index cf0b6e5e..535c5f64 100644 --- a/test/model-definition.test.js +++ b/test/model-definition.test.js @@ -4,6 +4,7 @@ // License text available at https://opensource.org/licenses/MIT // This test written in mocha+should.js +'use strict'; var should = require('./init.js'); var assert = require('assert'); diff --git a/test/operation-hooks.suite/embeds-many-create.suite.js b/test/operation-hooks.suite/embeds-many-create.suite.js index 86afae7b..b6dfcdec 100644 --- a/test/operation-hooks.suite/embeds-many-create.suite.js +++ b/test/operation-hooks.suite/embeds-many-create.suite.js @@ -3,6 +3,8 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +'use strict'; + var ValidationError = require('../..').ValidationError; var contextTestHelpers = require('../helpers/context-test-helpers'); diff --git a/test/operation-hooks.suite/embeds-many-destroy.suite.js b/test/operation-hooks.suite/embeds-many-destroy.suite.js index 3babfd25..10e2f79e 100644 --- a/test/operation-hooks.suite/embeds-many-destroy.suite.js +++ b/test/operation-hooks.suite/embeds-many-destroy.suite.js @@ -3,6 +3,8 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +'use strict'; + var Promise = require('bluebird'); var ValidationError = require('../..').ValidationError; @@ -46,7 +48,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { } }); - var ownerInstance, existingInstance; + var ownerInstance, existingInstance, existingItem, existingItem; beforeEach(function setupData() { return Owner.create({}) .then(function(inst) { diff --git a/test/operation-hooks.suite/embeds-many-update-by-id.suite.js b/test/operation-hooks.suite/embeds-many-update-by-id.suite.js index 930c3ddb..cdb4fb2f 100644 --- a/test/operation-hooks.suite/embeds-many-update-by-id.suite.js +++ b/test/operation-hooks.suite/embeds-many-update-by-id.suite.js @@ -3,6 +3,8 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +'use strict'; + var Promise = require('bluebird'); var ValidationError = require('../..').ValidationError; diff --git a/test/operation-hooks.suite/embeds-one-create.suite.js b/test/operation-hooks.suite/embeds-one-create.suite.js index bd9495ee..c0405b0f 100644 --- a/test/operation-hooks.suite/embeds-one-create.suite.js +++ b/test/operation-hooks.suite/embeds-one-create.suite.js @@ -3,6 +3,8 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +'use strict'; + var ValidationError = require('../..').ValidationError; var contextTestHelpers = require('../helpers/context-test-helpers'); diff --git a/test/operation-hooks.suite/embeds-one-destroy.suite.js b/test/operation-hooks.suite/embeds-one-destroy.suite.js index 1b425655..a25ddc02 100644 --- a/test/operation-hooks.suite/embeds-one-destroy.suite.js +++ b/test/operation-hooks.suite/embeds-one-destroy.suite.js @@ -3,6 +3,8 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +'use strict'; + var ValidationError = require('../..').ValidationError; var contextTestHelpers = require('../helpers/context-test-helpers'); @@ -45,7 +47,7 @@ module.exports = function(dataSource, should, connectorCapabilities) { } }); - var ownerInstance, existingInstance; + var ownerInstance, existingInstance, existingItem; beforeEach(function setupData() { return Owner.create({}) .then(function(inst) { diff --git a/test/operation-hooks.suite/embeds-one-update.suite.js b/test/operation-hooks.suite/embeds-one-update.suite.js index 24d80ae4..c9900554 100644 --- a/test/operation-hooks.suite/embeds-one-update.suite.js +++ b/test/operation-hooks.suite/embeds-one-update.suite.js @@ -3,6 +3,8 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +'use strict'; + var ValidationError = require('../..').ValidationError; var contextTestHelpers = require('../helpers/context-test-helpers'); diff --git a/test/operation-hooks.suite/index.js b/test/operation-hooks.suite/index.js index 1b9fcab7..3f43346d 100644 --- a/test/operation-hooks.suite/index.js +++ b/test/operation-hooks.suite/index.js @@ -1,3 +1,5 @@ +'use strict'; + var debug = require('debug')('test'); var fs = require('fs'); var path = require('path'); diff --git a/test/optional-validation.test.js b/test/optional-validation.test.js index e9de811e..2dba8d80 100644 --- a/test/optional-validation.test.js +++ b/test/optional-validation.test.js @@ -4,6 +4,7 @@ // License text available at https://opensource.org/licenses/MIT // This test written in mocha+should.js +'use strict'; var async = require('async'); var should = require('./init.js'); var db, User, options, ModelWithForceId, whereCount = 0; diff --git a/test/persistence-hooks.suite.js b/test/persistence-hooks.suite.js index 8c55a295..1c21720f 100644 --- a/test/persistence-hooks.suite.js +++ b/test/persistence-hooks.suite.js @@ -3,6 +3,7 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +'use strict'; var ValidationError = require('../').ValidationError; var contextTestHelpers = require('./helpers/context-test-helpers'); diff --git a/test/relations.test.js b/test/relations.test.js index 31d2edca..47a8ad4c 100644 --- a/test/relations.test.js +++ b/test/relations.test.js @@ -4,6 +4,7 @@ // License text available at https://opensource.org/licenses/MIT // This test written in mocha+should.js +'use strict'; var should = require('./init.js'); var jdb = require('../'); var DataSource = jdb.DataSource; @@ -3826,7 +3827,7 @@ describe('relations', 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. - + var Passport; before(function() { db = getMemoryDataSource(); Person = db.define('Person', {name: String}); @@ -3878,7 +3879,7 @@ describe('relations', function() { }); describe('embedsOne - generated id', function() { - + var Passport; before(function() { tmp = getTransientDataSource(); // db = getSchema(); diff --git a/test/schema.test.js b/test/schema.test.js index d4497d70..92982176 100644 --- a/test/schema.test.js +++ b/test/schema.test.js @@ -4,6 +4,7 @@ // License text available at https://opensource.org/licenses/MIT // This test written in mocha+should.js +'use strict'; var should = require('./init.js'); var db = getSchema(), slave = getSchema(), Model, SlaveModel; diff --git a/test/scope.test.js b/test/scope.test.js index 963b08e8..543cf37b 100644 --- a/test/scope.test.js +++ b/test/scope.test.js @@ -4,6 +4,7 @@ // License text available at https://opensource.org/licenses/MIT // This test written in mocha+should.js +'use strict'; var should = require('./init.js'); var db, Railway, Station; diff --git a/test/spec_helper.js b/test/spec_helper.js index 27a75c61..9be024d2 100644 --- a/test/spec_helper.js +++ b/test/spec_helper.js @@ -13,6 +13,8 @@ } */ +'use strict'; + var group_name = false, EXT_EXP; function it(should, test_case) { check_external_exports(); diff --git a/test/transient.test.js b/test/transient.test.js index d427026b..92dd3ed2 100644 --- a/test/transient.test.js +++ b/test/transient.test.js @@ -3,6 +3,7 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +'use strict'; var jdb = require('../'); var DataSource = jdb.DataSource; var assert = require('assert'); diff --git a/test/util.test.js b/test/util.test.js index 63cc0fdf..a8c8f8d1 100644 --- a/test/util.test.js +++ b/test/util.test.js @@ -3,6 +3,7 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +'use strict'; var should = require('./init.js'); var utils = require('../lib/utils'); var fieldsToArray = utils.fieldsToArray; diff --git a/test/validations.test.js b/test/validations.test.js index 7510b56f..daed9985 100644 --- a/test/validations.test.js +++ b/test/validations.test.js @@ -4,6 +4,7 @@ // License text available at https://opensource.org/licenses/MIT // This test written in mocha+should.js +'use strict'; var should = require('./init.js'); var async = require('async');