Merge pull request #1803 from strongloop/update-eslint

chore: update eslint to 6.x
This commit is contained in:
Miroslav Bajtoš 2019-12-03 16:13:31 +01:00 committed by GitHub
commit 606880bf79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
39 changed files with 184 additions and 190 deletions

View File

@ -73,7 +73,7 @@ function setup(done) {
function(items) {
createdUsers = items;
createPassports();
}
},
);
}
@ -88,7 +88,7 @@ function setup(done) {
function(items) {
createdPassports = items;
createPosts();
}
},
);
}
@ -105,7 +105,7 @@ function setup(done) {
function(items) {
createdPosts = items;
done();
}
},
);
}
});

View File

@ -109,9 +109,9 @@ Physician.create({name: 'Dr John'}, function(err, physician1) {
patient1.physicians.create({name: 'Dr X'}, function(err, patient4) {
console.log('Physician 4: ', patient4, patient4.constructor.modelName);
});
}
},
);
}
},
);
});
});

View File

@ -47,7 +47,7 @@ KeyValueMemoryConnector.prototype._setupRegularCleanup = function() {
clearInterval(this._cleanupTimer);
}
},
1000
1000,
);
this._cleanupTimer.unref();
};

View File

@ -136,7 +136,7 @@ function invokeConnectorMethod(connector, method, Model, args, options, cb) {
// If the DataSource is a transaction and no transaction object is provide in
// the options yet, add it to the options, see: DataSource#transaction()
const opts = dataSource.isTransaction && !options.transaction ? Object.assign(
options, {transaction: dataSource.currentTransaction}
options, {transaction: dataSource.currentTransaction},
) : options;
const optionsSupported = connector[method].length >= args.length + 3;
const transaction = opts.transaction;
@ -144,7 +144,7 @@ function invokeConnectorMethod(connector, method, Model, args, options, cb) {
if (!optionsSupported) {
return process.nextTick(function() {
cb(new Error(g.f(
'The connector does not support {{method}} within a transaction', method
'The connector does not support {{method}} within a transaction', method,
)));
});
}
@ -2593,7 +2593,7 @@ DataAccessObject.replaceById = function(id, data, options, cb) {
err = new Error(g.f(
'The connector %s does not support {{replaceById}} operation. This is not a bug in LoopBack. ' +
'Please contact the authors of the connector, preferably via GitHub issues.',
connector.name
connector.name,
));
return cb(err);
}

View File

@ -429,7 +429,7 @@ DataSource.prototype.setup = function(dsName, settings) {
console.warn(
'A datasource is created with name %j, which is different from the name in settings (%j). ' +
'Please adjust your configuration to ensure these names match.',
dsName, settings.name
dsName, settings.name,
);
}
@ -2386,7 +2386,7 @@ DataSource.prototype.transaction = function(execute, options, cb) {
if (!transaction) {
process.nextTick(function() {
cb(new Error(g.f(
'Transaction is not ready, wait for the returned promise to resolve'
'Transaction is not ready, wait for the returned promise to resolve',
)));
});
}
@ -2668,14 +2668,14 @@ DataSource.prototype.execute = function(command, args = [], options = {}) {
if (!this.connector) {
return Promise.reject(errorNotImplemented(
`DataSource "${this.name}" is missing a connector to execute the command.`
`DataSource "${this.name}" is missing a connector to execute the command.`,
));
}
if (!this.connector.execute) {
return Promise.reject(new errorNotImplemented(
`The connector "${this.connector.name}" used by dataSource "${this.name}" ` +
'does not implement "execute()" API.'
'does not implement "execute()" API.',
));
}

View File

@ -513,7 +513,7 @@ Inclusion.include = function(objects, include, options, cb) {
if (!targetId) {
const err = new Error(g.f(
'LinkManyToMany received target that doesn\'t contain required "%s"',
modelToIdName
modelToIdName,
));
return next(err);
}

View File

@ -462,7 +462,7 @@ ModelUtils._coerce = function(where, options, modelDef) {
'The %s property has invalid clause %j: Expected precisely 2 values, received %d',
p,
where[p],
val.length
val.length,
));
err.statusCode = 400;
throw err;
@ -476,7 +476,7 @@ ModelUtils._coerce = function(where, options, modelDef) {
err = new Error(g.f(
'The %s property has invalid clause %j: Expected a string or RegExp',
p,
where[p]
where[p],
));
err.statusCode = 400;
throw err;

View File

@ -251,7 +251,7 @@ ModelBaseClass.prototype._initProperties = function(data, options) {
throw new Error(g.f(
'Property names containing dot(s) are not supported. ' +
'Model: %s, dynamic property: %s',
this.constructor.modelName, p
this.constructor.modelName, p,
));
}
} else {

View File

@ -163,11 +163,11 @@ ObserverMixin.notifyObserversOf = function(operation, context, callback) {
if (retval && typeof retval.then === 'function') {
retval.then(
function() { next(); return null; },
next // error handler
next, // error handler
);
}
},
function(err) { callback(err, context); }
function(err) { callback(err, context); },
);
});
return callback.promise;
@ -244,7 +244,7 @@ ObserverMixin.notifyObserversAround = function(operation, context, fn, callback)
'Calling back with the hook error only.' +
'\nOriginal error: %s\nHook error: %s\n',
err.stack || err,
_err.stack || _err
_err.stack || _err,
);
}
callback.call(null, _err || err, context);

View File

@ -115,7 +115,7 @@ function preventFkOverride(inst, data, fkProp) {
'Cannot override foreign key %s from %s to %s',
fkProp,
inst[fkProp],
data[fkProp]
data[fkProp],
));
}
}
@ -1825,7 +1825,7 @@ HasOne.prototype.create = function(targetModelData, options, cb) {
} else {
cb && cb(new Error(g.f(
'{{HasOne}} relation cannot create more than one instance of %s',
modelTo.modelName
modelTo.modelName,
)));
}
});
@ -2073,7 +2073,7 @@ RelationDefinition.embedsOne = function(modelFrom, modelToRef, params) {
const opts = Object.assign(
params.options && params.options.property ? params.options.property : {},
{type: modelTo}
{type: modelTo},
);
if (params.default === true) {
@ -2476,7 +2476,7 @@ RelationDefinition.embedsMany = function embedsMany(modelFrom, modelToRef, param
{
type: [modelTo],
default: function() { return []; },
}
},
);
modelFrom.dataSource.defineProperty(modelFrom.modelName, propertyName, opts);

View File

@ -342,7 +342,7 @@ function escapeRegExp(str) {
console.warn(
'Auto-escaping invalid RegExp value %j supplied by the caller. ' +
'Please note this behavior may change in the future.',
str
str,
);
return str.replace(/[\-\[\]\/\{\}\(\)\+\?\.\\\^\$\|]/g, '\\$&');
}
@ -434,8 +434,8 @@ function sanitizeQuery(query, options) {
console.error(
g.f(
'Potential security alert: hidden/protected properties %j are used in query.',
offendingKeys
)
offendingKeys,
),
);
}
return result;
@ -679,7 +679,7 @@ function uniq(a) {
}
assert(Array.isArray(a), 'array argument is required');
const comparableA = a.map(
item => isBsonType(item) ? item.toString() : item
item => isBsonType(item) ? item.toString() : item,
);
for (let i = 0, n = comparableA.length; i < n; i++) {
if (comparableA.indexOf(comparableA[i]) === i) {

View File

@ -871,7 +871,7 @@ function ValidationError(obj) {
this.message = g.f(
'The %s instance is not valid. Details: %s.',
context ? '`' + context + '`' : 'model',
formatErrors(obj.errors, obj.toJSON()) || '(unknown)'
formatErrors(obj.errors, obj.toJSON()) || '(unknown)',
);
this.statusCode = 422;

View File

@ -39,7 +39,7 @@
"async-iterators": "^0.2.2",
"bson": "^4.0.1",
"coveralls": "^3.0.1",
"eslint": "^5.1.0",
"eslint": "^6.7.2",
"eslint-config-loopback": "^13.0.0",
"loopback-connector-throwing": "file:./test/fixtures/loopback-connector-throwing",
"mocha": "^6.1.4",

View File

@ -51,14 +51,14 @@ const operations = [
function findOrCreate_found(ds) {
return ds.TestModel.findOrCreate(
{where: {name: ds.existingInstance.name}},
{name: ds.existingInstance.name}
{name: ds.existingInstance.name},
);
},
function findOrCreate_create(ds) {
return ds.TestModel.findOrCreate(
{where: {name: 'new-record'}},
{name: 'new-record'}
{name: 'new-record'},
);
},
@ -68,7 +68,7 @@ const operations = [
function updateOrCreate_update(ds) {
return ds.TestModel.updateOrCreate(
{id: ds.existingInstance.id, name: 'new name'}
{id: ds.existingInstance.id, name: 'new name'},
);
},
@ -78,14 +78,14 @@ const operations = [
function replaceOrCreate_update(ds) {
return ds.TestModel.replaceOrCreate(
{id: ds.existingInstance.id, name: 'new name'}
{id: ds.existingInstance.id, name: 'new name'},
);
},
function replaceById(ds) {
return ds.TestModel.replaceById(
ds.existingInstance.id,
{name: 'new name'}
{name: 'new name'},
);
},

View File

@ -322,7 +322,7 @@ describe('async observer', function() {
},
function(err) {
err.should.eql(testError);
}
},
);
});

View File

@ -127,10 +127,10 @@ describe('basic-querying', function() {
return u.name;
});
names.should.eql(
[createdUsers[2].name, createdUsers[1].name, createdUsers[0].name]
[createdUsers[2].name, createdUsers[1].name, createdUsers[0].name],
);
done();
}
},
);
});

View File

@ -90,7 +90,7 @@ describe('crud-with-options', function() {
function(done) {
User.findById(undefined, {}, function(err, u) {
err.should.be.eql(
new Error('Model::findById requires the id argument')
new Error('Model::findById requires the id argument'),
);
done();
});

View File

@ -376,7 +376,7 @@ describe('DataSource', function() {
const result = await ds.execute(
'command',
['arg1', 'arg2'],
{'a-flag': 'a-value'}
{'a-flag': 'a-value'},
);
result.should.be.equal('a-result');

View File

@ -295,7 +295,7 @@ describe('datatypes', function() {
},
{
persistUndefinedAsNull: true,
}
},
);
isStrict = TestModel.definition.settings.strict;
@ -385,13 +385,13 @@ describe('datatypes', function() {
TestModel.modelName,
{where: {id: created.id}},
{},
cb
cb,
);
} else {
TestModel.dataSource.connector.all(
TestModel.modelName,
{where: {id: created.id}},
cb
cb,
);
}
});

View File

@ -3,9 +3,6 @@
// This file is licensed under the MIT License.
// License text available at https://opensource.org/licenses/MIT
/* global describe,it */
/* jshint expr:true */
'use strict';
require('should');

View File

@ -80,7 +80,7 @@ describe('Memory connector with mocked discovery', function() {
const s = schemas['STRONGLOOP.INVENTORY'];
s.name.should.be.eql('Inventory');
Object.keys(s.properties).should.be.eql(
['productId', 'locationId', 'available', 'total']
['productId', 'locationId', 'available', 'total'],
);
done();
});
@ -98,7 +98,7 @@ describe('Memory connector with mocked discovery', function() {
const s = schemas['STRONGLOOP.INVENTORY'];
s.name.should.be.eql('inventory');
Object.keys(s.properties).should.be.eql(
['product_id', 'location_id', 'available', 'total']
['product_id', 'location_id', 'available', 'total'],
);
done();
});
@ -112,7 +112,7 @@ describe('Memory connector with mocked discovery', function() {
const s = schemas['STRONGLOOP.INVENTORY'];
s.name.should.be.eql('INVENTORY');
Object.keys(s.properties).should.be.eql(
['PRODUCT_ID', 'LOCATION_ID', 'AVAILABLE', 'TOTAL']
['PRODUCT_ID', 'LOCATION_ID', 'AVAILABLE', 'TOTAL'],
);
done();
});
@ -172,7 +172,7 @@ describe('Memory connector with mocked discovery', function() {
s.name.should.be.eql('Inventory');
Object.keys(s.properties).should.be.eql(
['productId', 'locationId', 'available', 'total']
['productId', 'locationId', 'available', 'total'],
);
done();
})
@ -312,7 +312,7 @@ describe('discoverModelDefinitions', function() {
});
tableNames.should.be.eql(
['CUSTOMER', 'INVENTORY', 'LOCATION']
['CUSTOMER', 'INVENTORY', 'LOCATION'],
);
done();
});
@ -327,7 +327,7 @@ describe('discoverModelDefinitions', function() {
});
tableNames.should.be.eql(
['CUSTOMER', 'INVENTORY', 'LOCATION']
['CUSTOMER', 'INVENTORY', 'LOCATION'],
);
done();
};
@ -343,7 +343,7 @@ describe('discoverModelDefinitions', function() {
});
tableNames.should.be.eql(
['CUSTOMER', 'INVENTORY', 'LOCATION']
['CUSTOMER', 'INVENTORY', 'LOCATION'],
);
done();
})

View File

@ -3,9 +3,6 @@
// This file is licensed under the MIT License.
// License text available at https://opensource.org/licenses/MIT
/* global describe,it */
/* jshint expr:true */
'use strict';
require('should');

View File

@ -411,7 +411,7 @@ describe('hooks', function() {
it('should describe isValid sequence', function(done) {
should.not.exist(
user.constructor._validations,
'Expected user to have no validations, but she have'
'Expected user to have no validations, but she have',
);
user.isValid(function(valid) {
valid.should.be.true;

View File

@ -1596,7 +1596,7 @@ function setup(done) {
createdUsers = items;
createPassports();
createAccessTokens();
}
},
);
}
function createAccessTokens() {
@ -1606,7 +1606,7 @@ function setup(done) {
{token: '1', userId: createdUsers[0].id},
{token: '2', userId: createdUsers[1].id},
],
function(items) {}
function(items) {},
);
}
@ -1622,7 +1622,7 @@ function setup(done) {
function(items) {
createdPassports = items;
createPosts();
}
},
);
}
@ -1637,7 +1637,7 @@ function setup(done) {
function(items) {
createdProfiles = items;
done();
}
},
);
}
@ -1654,7 +1654,7 @@ function setup(done) {
function(items) {
createdPosts = items;
createProfiles();
}
},
);
}
});

View File

@ -31,7 +31,7 @@ function givenKeys(Model, keys, cb) {
let p = Promise.all(
keys.map(function(k) {
return Model.set(k, 'value-' + k);
})
}),
);
if (cb) {
p = p.then(function(r) { cb(null, r); }, cb);

View File

@ -53,7 +53,7 @@ module.exports = function(dataSourceFactory, connectorCapabilities) {
function(err) {
err.message.should.match(/expired-key/);
err.should.have.property('statusCode', 404);
}
},
);
});
@ -63,7 +63,7 @@ module.exports = function(dataSourceFactory, connectorCapabilities) {
function(err) {
err.message.should.match(/key-does-not-exist/);
err.should.have.property('statusCode', 404);
}
},
);
});

View File

@ -30,7 +30,7 @@ module.exports = function(dataSourceFactory, connectorCapabilities) {
it('gets TTL when key with unexpired TTL exists - Promise API',
function() {
return Promise.resolve(
CacheItem.set('a-key', 'a-value', {ttl: INITIAL_TTL})
CacheItem.set('a-key', 'a-value', {ttl: INITIAL_TTL}),
)
.then(() => helpers.delay(SMALL_DELAY))
.then(function() { return CacheItem.ttl('a-key'); })
@ -57,7 +57,7 @@ module.exports = function(dataSourceFactory, connectorCapabilities) {
it('fails when getting TTL for a key with expired TTL', function() {
return Promise.resolve(
CacheItem.set('expired-key', 'a-value', {ttl: TTL_PRECISION})
CacheItem.set('expired-key', 'a-value', {ttl: TTL_PRECISION}),
)
.then(() => helpers.delay(2 * TTL_PRECISION))
.then(function() {
@ -68,7 +68,7 @@ module.exports = function(dataSourceFactory, connectorCapabilities) {
function(err) {
err.message.should.match(/expired-key/);
err.should.have.property('statusCode', 404);
}
},
);
});
@ -78,7 +78,7 @@ module.exports = function(dataSourceFactory, connectorCapabilities) {
function(err) {
err.message.should.match(/key-does-not-exist/);
err.should.have.property('statusCode', 404);
}
},
);
});

View File

@ -749,10 +749,10 @@ describe('Model loaded with a base', function() {
Customer1.definition.properties.should.have.property('name');
Customer2.definition.properties.should.have.property('name');
Customer1.definition.properties.name.should.not.be.equal(
Customer2.definition.properties.name
Customer2.definition.properties.name,
);
Customer1.definition.properties.name.should.eql(
Customer2.definition.properties.name
Customer2.definition.properties.name,
);
});

View File

@ -364,7 +364,7 @@ describe('manipulation', function() {
should.equal(result.gender, null);
done();
});
}
},
);
});
@ -942,9 +942,9 @@ describe('manipulation', function() {
should.equal(result.gender, null);
done();
}
},
);
}
},
);
});
@ -991,7 +991,7 @@ describe('manipulation', function() {
function(err, inst) {
if (err) return done(err);
inst.save(done);
}
},
);
});
@ -1654,7 +1654,7 @@ describe('manipulation', function() {
p.gender.should.equal('male');
created.should.equal(false);
done();
}
},
);
});
@ -1678,7 +1678,7 @@ describe('manipulation', function() {
it('should find a record if exists (promise variant)', function(done) {
Person.findOrCreate(
{where: {name: 'Jed'}},
{name: 'Jed', gender: 'male'}
{name: 'Jed', gender: 'male'},
)
.then(function(res) {
res.should.be.instanceOf(Array);
@ -2489,7 +2489,7 @@ describe('manipulation', function() {
should.equal(result.city, null);
done();
});
}
},
);
});

View File

@ -406,7 +406,7 @@ describe('ModelDefinition class', function() {
return Child.update({name: 'childA'}, {secret: 'new-secret'}, optionsFromRemoteReq).then(
function(result) {
result.count.should.equal(1);
}
},
);
});

View File

@ -292,6 +292,6 @@ function seed(User, done) {
async.each(beatles, User.create.bind(User), cb);
},
],
done
done,
);
}

View File

@ -72,7 +72,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
function(err, result) {
if (err) reject(err);
else resolve(result);
}
},
);
});
}

View File

@ -73,7 +73,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
function(err, result) {
if (err) reject(err);
else resolve(result);
}
},
);
});
}

View File

@ -24,7 +24,7 @@ describe('optional-validation', function() {
ModelWithForceId = db.createModel(
'ModelWithForceId',
{name: String},
{forceId: true}
{forceId: true},
);
User = db.define('User', {
seq: {type: Number, index: true},

View File

@ -109,7 +109,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
'loaded',
]);
done();
}
},
);
});
@ -137,7 +137,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
if (err) return done(err);
hookMonitor.names.should.be.empty();
done();
}
},
);
});
@ -243,7 +243,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
if (err) return done(err);
hookMonitor.names.should.be.empty();
done();
}
},
);
});
@ -342,7 +342,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
list[0].should.have.property('extra', 'hook data');
done();
}
},
);
});
@ -353,7 +353,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
function(err, list) {
[err].should.eql([expectedError]);
done();
}
},
);
});
});
@ -374,7 +374,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
'after save',
]);
done();
}
},
);
});
@ -451,7 +451,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
}),
]);
done();
}
},
);
});
@ -480,7 +480,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
}));
done();
}
},
);
});
@ -514,7 +514,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
});
done();
});
}
},
);
});
@ -537,7 +537,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
}));
done();
}
},
);
});
@ -548,7 +548,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
function(err, instance) {
[err].should.eql([expectedError]);
done();
}
},
);
});
@ -570,7 +570,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
instance.should.have.property('extra', 'hook data');
done();
}
},
);
});
@ -636,7 +636,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
}),
]);
done();
}
},
);
});
@ -666,7 +666,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
isNewInstance: true,
}));
done();
}
},
);
});
});
@ -687,7 +687,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
skip: 0,
}}));
done();
}
},
);
});
@ -710,7 +710,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
isNewInstance: true,
}));
done();
}
},
);
});
}
@ -732,7 +732,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
isNewInstance: true,
}));
done();
}
},
);
});
@ -746,7 +746,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
(err || {}).should.be.instanceOf(ValidationError);
(err.details.codes || {}).should.eql({name: ['presence']});
done();
}
},
);
});
@ -766,7 +766,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
'after save',
]);
done();
}
},
);
});
@ -793,7 +793,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
]);
}
done();
}
},
);
});
@ -806,7 +806,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
function(err, instance) {
[err].should.eql([expectedError]);
done();
}
},
);
});
@ -819,7 +819,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
function(err, instance) {
[err].should.eql([expectedError]);
done();
}
},
);
});
@ -856,7 +856,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
}));
done();
}
},
);
});
}
@ -897,7 +897,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
}));
}
done();
}
},
);
});
@ -932,7 +932,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
});
done();
}
},
);
});
}
@ -972,7 +972,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
});
}
done();
}
},
);
});
@ -1000,7 +1000,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
}));
done();
}
},
);
});
}
@ -1023,7 +1023,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
}));
done();
}
},
);
});
@ -1035,7 +1035,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
function(err, instance) {
[err].should.eql([expectedError]);
done();
}
},
);
});
@ -1055,7 +1055,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
instance.should.have.property('extra', 'hook data');
done();
}
},
);
});
}
@ -1082,7 +1082,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
instance.should.have.property('extra', 'hook data');
done();
}
},
);
});
@ -1103,7 +1103,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
isNewInstance: true,
}));
done();
}
},
);
});
@ -1117,7 +1117,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
if (err) return done(err);
ctxRecorder.records.should.eql('hook not called');
done();
}
},
);
});
});
@ -1163,7 +1163,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
'after save',
]);
done();
}
},
);
});
@ -1282,7 +1282,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
function(err, instance) {
[err].should.eql([expectedError]);
done();
}
},
);
});
@ -1326,7 +1326,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
// PersistedModel.create and force it to call connector.save()
const instance = new TestModel(
{id: 'new-id', name: 'created'},
{persisted: true}
{persisted: true},
);
instance.save(function(err, instance) {
@ -1383,7 +1383,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
'after save',
]);
done();
}
},
);
});
@ -1544,7 +1544,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
});
done();
});
}
},
);
});
});
@ -1581,7 +1581,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
function(err, instance) {
[err].should.eql([expectedError]);
done();
}
},
);
});
@ -1663,7 +1663,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
'after save',
]);
done();
}
},
);
});
@ -1807,7 +1807,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
});
done();
});
}
},
);
});
});
@ -1836,7 +1836,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
function(err, instance) {
[err].should.eql([expectedError]);
done();
}
},
);
});
@ -1912,7 +1912,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
'after save',
]);
done();
}
},
);
});
@ -1931,7 +1931,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
'after save',
]);
done();
}
},
);
});
@ -1946,7 +1946,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
where: {id: 'not-found'},
}}));
done();
}
},
);
});
@ -1961,7 +1961,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
where: {id: existingInstance.id},
}}));
done();
}
},
);
});
@ -1974,7 +1974,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
if (err) return done(err);
ctxRecorder.records.should.equal('hook not called');
done();
}
},
);
});
@ -1996,7 +1996,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
]);
done();
});
}
},
);
});
@ -2019,7 +2019,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
]);
done();
});
}
},
);
});
@ -2037,7 +2037,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
if (err) return done(err);
hookMonitor.names.should.eql(['access', 'before save']);
done();
}
},
);
});
@ -2067,7 +2067,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
}));
}
done();
}
},
);
});
@ -2097,7 +2097,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
}
done();
}
},
);
});
@ -2114,7 +2114,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
if (err) return done(err);
instance.name.should.equal('hooked');
done();
}
},
);
});
@ -2135,7 +2135,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
if (err) return done(err);
instance.name.should.equal('hooked');
done();
}
},
);
});
@ -2150,7 +2150,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
(err || {}).should.be.instanceOf(ValidationError);
(err.details.codes || {}).should.eql({name: ['presence']});
done();
}
},
);
});
@ -2165,7 +2165,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
(err || {}).should.be.instanceOf(ValidationError);
(err.details.codes || {}).should.eql({name: ['presence']});
done();
}
},
);
});
@ -2202,7 +2202,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
}));
}
done();
}
},
);
});
@ -2235,7 +2235,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
ctxRecorder.records.should.eql(expectedContext);
done();
}
},
);
});
@ -2262,7 +2262,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
}));
}
done();
}
},
);
});
@ -2281,7 +2281,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
isNewInstance: isNewInstanceFlag ? false : undefined,
}));
done();
}
},
);
});
@ -2292,7 +2292,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
function(err, instance) {
[err].should.eql([expectedError]);
done();
}
},
);
});
@ -2312,7 +2312,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
isNewInstance: isNewInstanceFlag ? false : undefined,
}));
done();
}
},
);
});
@ -2343,7 +2343,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
isNewInstance: isNewInstanceFlag ? true : undefined,
}));
done();
}
},
);
});
});
@ -2367,7 +2367,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
'after save',
]);
done();
}
},
);
});
@ -2386,7 +2386,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
'after save',
]);
done();
}
},
);
});
@ -2401,7 +2401,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
where: {id: 'not-found'},
}}));
done();
}
},
);
});
@ -2416,7 +2416,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
where: {id: existingInstance.id},
}}));
done();
}
},
);
});
@ -2429,7 +2429,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
if (err) return done(err);
ctxRecorder.records.should.equal('hook not called');
done();
}
},
);
});
@ -2451,7 +2451,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
]);
done();
});
}
},
);
});
@ -2474,7 +2474,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
]);
done();
});
}
},
);
});
@ -2492,7 +2492,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
if (err) return done(err);
hookMonitor.names.should.eql(['access', 'before save']);
done();
}
},
);
});
@ -2535,7 +2535,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
ctxRecorder.records.should.eql(expectedContext);
done();
}
},
);
});
@ -2561,7 +2561,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
ctxRecorder.records.should.eql(expectedContext);
done();
}
},
);
});
@ -2577,7 +2577,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
if (err) return done(err);
instance.name.should.equal('hooked');
done();
}
},
);
});
@ -2590,7 +2590,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
(err || {}).should.be.instanceOf(ValidationError);
(err.details.codes || {}).should.eql({name: ['presence']});
done();
}
},
);
});
@ -2624,7 +2624,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
}
ctxRecorder.records.should.eql(expectedContext);
done();
}
},
);
});
@ -2657,7 +2657,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
ctxRecorder.records.should.eql(expectedContext);
done();
}
},
);
});
@ -2684,7 +2684,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
found.should.have.property('extra', 'hook data');
done();
});
}
},
);
});
@ -2730,7 +2730,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
ctxRecorder.records.should.eql(aCtxForModel(TestModel, expected));
done();
}
},
);
});
@ -2755,7 +2755,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
ctxRecorder.records.should.eql(aCtxForModel(TestModel, expected));
done();
}
},
);
});
@ -2766,7 +2766,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
function(err, instance) {
[err].should.eql([expectedError]);
done();
}
},
);
});
@ -2792,7 +2792,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
ctxRecorder.records.should.eql(aCtxForModel(TestModel, expected));
done();
}
},
);
});
@ -2817,7 +2817,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
ctxRecorder.records.should.eql(aCtxForModel(TestModel, expected));
done();
}
},
);
});
});
@ -2843,7 +2843,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
'after save',
]);
done();
}
},
);
});
@ -2884,7 +2884,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
ctxRecorder.records.should.eql(expectedContext);
done();
}
},
);
});
@ -2906,7 +2906,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
found.should.have.property('extra', 'hook data');
done();
});
}
},
);
});
});
@ -3105,7 +3105,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
TestModel.findById(existingInstance.id, function(err, inst) {
if (err) return done(err);
(inst ? inst.toObject() : 'null').should.eql(
existingInstance.toObject()
existingInstance.toObject(),
);
done();
});
@ -3204,7 +3204,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
where: {name: 'searched'},
}}));
done();
}
},
);
});
@ -3227,7 +3227,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
]);
done();
});
}
},
);
});
@ -3244,7 +3244,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
data: {name: 'updated'},
}));
done();
}
},
);
});
@ -3265,7 +3265,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
instance.should.have.property('extra', 'added');
done();
});
}
},
);
});
@ -3284,7 +3284,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
}));
done();
}
},
);
});
@ -3303,7 +3303,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
instance.should.have.property('extra', 'hook data');
done();
});
}
},
);
});
@ -3317,7 +3317,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
if (err) return done(err);
ctxRecorder.records.should.eql('hook not called');
done();
}
},
);
});
@ -3335,7 +3335,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
info: {count: 1},
}));
done();
}
},
);
});
@ -3352,7 +3352,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
foo: 'bar',
});
done();
}
},
);
});
});

View File

@ -2612,7 +2612,7 @@ describe('relations', function() {
const actual = pics.map(
function(pic) {
return {imageName: pic.name, name: pic.imageable().name};
}
},
);
actual.should.containDeep([
@ -6228,7 +6228,7 @@ describe('relations', function() {
err.name.should.equal('ValidationError');
err.details.codes.jobs.should.eql(['uniqueness']);
done();
}
},
);
});
@ -6616,7 +6616,7 @@ describe('relations', function() {
type: 'hasMany',
},
},
}
},
);
}).should.throw('Invalid relation name: trigger');
});

View File

@ -54,7 +54,7 @@ exports.init = function init(external_exports) {
function check_external_exports() {
if (!EXT_EXP) throw new Error(
'Before run this, please ensure that ' +
'require("spec_helper").init(exports); called'
'require("spec_helper").init(exports); called',
);
}

View File

@ -88,13 +88,13 @@ describe('util.sanitizeQuery', function() {
const q7 = {where: {x: 1}};
q7.where.y = q7;
(function() { sanitizeQuery(q7); }).should.throw(
/The query object is circular/
/The query object is circular/,
);
const q8 = {where: {and: [{and: [{and: [{and: [{and: [{and:
[{and: [{and: [{and: [{x: 1}]}]}]}]}]}]}]}]}]}};
(function() { sanitizeQuery(q8, {maxDepth: 12}); }).should.throw(
/The query object exceeds maximum depth 12/
/The query object exceeds maximum depth 12/,
);
// maxDepth is default to maximum integer
@ -102,7 +102,7 @@ describe('util.sanitizeQuery', function() {
const q9 = {where: {and: [{and: [{and: [{and: [{x: 1}]}]}]}]}};
(function() { sanitizeQuery(q8, {maxDepth: 4}); }).should.throw(
/The query object exceeds maximum depth 4/
/The query object exceeds maximum depth 4/,
);
});

View File

@ -348,7 +348,7 @@ describe('validations', function() {
if (options.testFlag !== 'someValue') {
console.error(
'Unexpected validation options: %j Expected %j',
options, {testFlag: 'someValue'}
options, {testFlag: 'someValue'},
);
err();
}
@ -609,13 +609,13 @@ describe('validations', function() {
function createSite1User(next) {
SiteUser.create(
{siteId: 1, email: EMAIL},
next
next,
);
},
function createSite2User(user1, next) {
SiteUser.create(
{siteId: 2, email: EMAIL},
next
next,
);
},
function validateDuplicateUser(user2, next) {
@ -1424,7 +1424,7 @@ describe('validations', function() {
obj.email = 'test@example.com';
const err = givenValidationError('user', obj, 'is invalid');
getErrorDetails(err).should.equal(
'`user` is invalid (value: { email: \'test@example.com\' }).'
'`user` is invalid (value: { email: \'test@example.com\' }).',
);
});