Merge pull request #1803 from strongloop/update-eslint
chore: update eslint to 6.x
This commit is contained in:
commit
606880bf79
|
@ -73,7 +73,7 @@ function setup(done) {
|
||||||
function(items) {
|
function(items) {
|
||||||
createdUsers = items;
|
createdUsers = items;
|
||||||
createPassports();
|
createPassports();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ function setup(done) {
|
||||||
function(items) {
|
function(items) {
|
||||||
createdPassports = items;
|
createdPassports = items;
|
||||||
createPosts();
|
createPosts();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ function setup(done) {
|
||||||
function(items) {
|
function(items) {
|
||||||
createdPosts = items;
|
createdPosts = items;
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -109,9 +109,9 @@ Physician.create({name: 'Dr John'}, function(err, physician1) {
|
||||||
patient1.physicians.create({name: 'Dr X'}, function(err, patient4) {
|
patient1.physicians.create({name: 'Dr X'}, function(err, patient4) {
|
||||||
console.log('Physician 4: ', patient4, patient4.constructor.modelName);
|
console.log('Physician 4: ', patient4, patient4.constructor.modelName);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -47,7 +47,7 @@ KeyValueMemoryConnector.prototype._setupRegularCleanup = function() {
|
||||||
clearInterval(this._cleanupTimer);
|
clearInterval(this._cleanupTimer);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
1000
|
1000,
|
||||||
);
|
);
|
||||||
this._cleanupTimer.unref();
|
this._cleanupTimer.unref();
|
||||||
};
|
};
|
||||||
|
|
|
@ -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
|
// If the DataSource is a transaction and no transaction object is provide in
|
||||||
// the options yet, add it to the options, see: DataSource#transaction()
|
// the options yet, add it to the options, see: DataSource#transaction()
|
||||||
const opts = dataSource.isTransaction && !options.transaction ? Object.assign(
|
const opts = dataSource.isTransaction && !options.transaction ? Object.assign(
|
||||||
options, {transaction: dataSource.currentTransaction}
|
options, {transaction: dataSource.currentTransaction},
|
||||||
) : options;
|
) : options;
|
||||||
const optionsSupported = connector[method].length >= args.length + 3;
|
const optionsSupported = connector[method].length >= args.length + 3;
|
||||||
const transaction = opts.transaction;
|
const transaction = opts.transaction;
|
||||||
|
@ -144,7 +144,7 @@ function invokeConnectorMethod(connector, method, Model, args, options, cb) {
|
||||||
if (!optionsSupported) {
|
if (!optionsSupported) {
|
||||||
return process.nextTick(function() {
|
return process.nextTick(function() {
|
||||||
cb(new Error(g.f(
|
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(
|
err = new Error(g.f(
|
||||||
'The connector %s does not support {{replaceById}} operation. This is not a bug in LoopBack. ' +
|
'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.',
|
'Please contact the authors of the connector, preferably via GitHub issues.',
|
||||||
connector.name
|
connector.name,
|
||||||
));
|
));
|
||||||
return cb(err);
|
return cb(err);
|
||||||
}
|
}
|
||||||
|
|
|
@ -429,7 +429,7 @@ DataSource.prototype.setup = function(dsName, settings) {
|
||||||
console.warn(
|
console.warn(
|
||||||
'A datasource is created with name %j, which is different from the name in settings (%j). ' +
|
'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.',
|
'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) {
|
if (!transaction) {
|
||||||
process.nextTick(function() {
|
process.nextTick(function() {
|
||||||
cb(new Error(g.f(
|
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) {
|
if (!this.connector) {
|
||||||
return Promise.reject(errorNotImplemented(
|
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) {
|
if (!this.connector.execute) {
|
||||||
return Promise.reject(new errorNotImplemented(
|
return Promise.reject(new errorNotImplemented(
|
||||||
`The connector "${this.connector.name}" used by dataSource "${this.name}" ` +
|
`The connector "${this.connector.name}" used by dataSource "${this.name}" ` +
|
||||||
'does not implement "execute()" API.'
|
'does not implement "execute()" API.',
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -513,7 +513,7 @@ Inclusion.include = function(objects, include, options, cb) {
|
||||||
if (!targetId) {
|
if (!targetId) {
|
||||||
const err = new Error(g.f(
|
const err = new Error(g.f(
|
||||||
'LinkManyToMany received target that doesn\'t contain required "%s"',
|
'LinkManyToMany received target that doesn\'t contain required "%s"',
|
||||||
modelToIdName
|
modelToIdName,
|
||||||
));
|
));
|
||||||
return next(err);
|
return next(err);
|
||||||
}
|
}
|
||||||
|
|
|
@ -462,7 +462,7 @@ ModelUtils._coerce = function(where, options, modelDef) {
|
||||||
'The %s property has invalid clause %j: Expected precisely 2 values, received %d',
|
'The %s property has invalid clause %j: Expected precisely 2 values, received %d',
|
||||||
p,
|
p,
|
||||||
where[p],
|
where[p],
|
||||||
val.length
|
val.length,
|
||||||
));
|
));
|
||||||
err.statusCode = 400;
|
err.statusCode = 400;
|
||||||
throw err;
|
throw err;
|
||||||
|
@ -476,7 +476,7 @@ ModelUtils._coerce = function(where, options, modelDef) {
|
||||||
err = new Error(g.f(
|
err = new Error(g.f(
|
||||||
'The %s property has invalid clause %j: Expected a string or RegExp',
|
'The %s property has invalid clause %j: Expected a string or RegExp',
|
||||||
p,
|
p,
|
||||||
where[p]
|
where[p],
|
||||||
));
|
));
|
||||||
err.statusCode = 400;
|
err.statusCode = 400;
|
||||||
throw err;
|
throw err;
|
||||||
|
|
|
@ -251,7 +251,7 @@ ModelBaseClass.prototype._initProperties = function(data, options) {
|
||||||
throw new Error(g.f(
|
throw new Error(g.f(
|
||||||
'Property names containing dot(s) are not supported. ' +
|
'Property names containing dot(s) are not supported. ' +
|
||||||
'Model: %s, dynamic property: %s',
|
'Model: %s, dynamic property: %s',
|
||||||
this.constructor.modelName, p
|
this.constructor.modelName, p,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -163,11 +163,11 @@ ObserverMixin.notifyObserversOf = function(operation, context, callback) {
|
||||||
if (retval && typeof retval.then === 'function') {
|
if (retval && typeof retval.then === 'function') {
|
||||||
retval.then(
|
retval.then(
|
||||||
function() { next(); return null; },
|
function() { next(); return null; },
|
||||||
next // error handler
|
next, // error handler
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
function(err) { callback(err, context); }
|
function(err) { callback(err, context); },
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
return callback.promise;
|
return callback.promise;
|
||||||
|
@ -244,7 +244,7 @@ ObserverMixin.notifyObserversAround = function(operation, context, fn, callback)
|
||||||
'Calling back with the hook error only.' +
|
'Calling back with the hook error only.' +
|
||||||
'\nOriginal error: %s\nHook error: %s\n',
|
'\nOriginal error: %s\nHook error: %s\n',
|
||||||
err.stack || err,
|
err.stack || err,
|
||||||
_err.stack || _err
|
_err.stack || _err,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
callback.call(null, _err || err, context);
|
callback.call(null, _err || err, context);
|
||||||
|
|
|
@ -115,7 +115,7 @@ function preventFkOverride(inst, data, fkProp) {
|
||||||
'Cannot override foreign key %s from %s to %s',
|
'Cannot override foreign key %s from %s to %s',
|
||||||
fkProp,
|
fkProp,
|
||||||
inst[fkProp],
|
inst[fkProp],
|
||||||
data[fkProp]
|
data[fkProp],
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1825,7 +1825,7 @@ HasOne.prototype.create = function(targetModelData, options, cb) {
|
||||||
} else {
|
} else {
|
||||||
cb && cb(new Error(g.f(
|
cb && cb(new Error(g.f(
|
||||||
'{{HasOne}} relation cannot create more than one instance of %s',
|
'{{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(
|
const opts = Object.assign(
|
||||||
params.options && params.options.property ? params.options.property : {},
|
params.options && params.options.property ? params.options.property : {},
|
||||||
{type: modelTo}
|
{type: modelTo},
|
||||||
);
|
);
|
||||||
|
|
||||||
if (params.default === true) {
|
if (params.default === true) {
|
||||||
|
@ -2476,7 +2476,7 @@ RelationDefinition.embedsMany = function embedsMany(modelFrom, modelToRef, param
|
||||||
{
|
{
|
||||||
type: [modelTo],
|
type: [modelTo],
|
||||||
default: function() { return []; },
|
default: function() { return []; },
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
modelFrom.dataSource.defineProperty(modelFrom.modelName, propertyName, opts);
|
modelFrom.dataSource.defineProperty(modelFrom.modelName, propertyName, opts);
|
||||||
|
|
|
@ -342,7 +342,7 @@ function escapeRegExp(str) {
|
||||||
console.warn(
|
console.warn(
|
||||||
'Auto-escaping invalid RegExp value %j supplied by the caller. ' +
|
'Auto-escaping invalid RegExp value %j supplied by the caller. ' +
|
||||||
'Please note this behavior may change in the future.',
|
'Please note this behavior may change in the future.',
|
||||||
str
|
str,
|
||||||
);
|
);
|
||||||
return str.replace(/[\-\[\]\/\{\}\(\)\+\?\.\\\^\$\|]/g, '\\$&');
|
return str.replace(/[\-\[\]\/\{\}\(\)\+\?\.\\\^\$\|]/g, '\\$&');
|
||||||
}
|
}
|
||||||
|
@ -434,8 +434,8 @@ function sanitizeQuery(query, options) {
|
||||||
console.error(
|
console.error(
|
||||||
g.f(
|
g.f(
|
||||||
'Potential security alert: hidden/protected properties %j are used in query.',
|
'Potential security alert: hidden/protected properties %j are used in query.',
|
||||||
offendingKeys
|
offendingKeys,
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
@ -679,7 +679,7 @@ function uniq(a) {
|
||||||
}
|
}
|
||||||
assert(Array.isArray(a), 'array argument is required');
|
assert(Array.isArray(a), 'array argument is required');
|
||||||
const comparableA = a.map(
|
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++) {
|
for (let i = 0, n = comparableA.length; i < n; i++) {
|
||||||
if (comparableA.indexOf(comparableA[i]) === i) {
|
if (comparableA.indexOf(comparableA[i]) === i) {
|
||||||
|
|
|
@ -871,7 +871,7 @@ function ValidationError(obj) {
|
||||||
this.message = g.f(
|
this.message = g.f(
|
||||||
'The %s instance is not valid. Details: %s.',
|
'The %s instance is not valid. Details: %s.',
|
||||||
context ? '`' + context + '`' : 'model',
|
context ? '`' + context + '`' : 'model',
|
||||||
formatErrors(obj.errors, obj.toJSON()) || '(unknown)'
|
formatErrors(obj.errors, obj.toJSON()) || '(unknown)',
|
||||||
);
|
);
|
||||||
|
|
||||||
this.statusCode = 422;
|
this.statusCode = 422;
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
"async-iterators": "^0.2.2",
|
"async-iterators": "^0.2.2",
|
||||||
"bson": "^4.0.1",
|
"bson": "^4.0.1",
|
||||||
"coveralls": "^3.0.1",
|
"coveralls": "^3.0.1",
|
||||||
"eslint": "^5.1.0",
|
"eslint": "^6.7.2",
|
||||||
"eslint-config-loopback": "^13.0.0",
|
"eslint-config-loopback": "^13.0.0",
|
||||||
"loopback-connector-throwing": "file:./test/fixtures/loopback-connector-throwing",
|
"loopback-connector-throwing": "file:./test/fixtures/loopback-connector-throwing",
|
||||||
"mocha": "^6.1.4",
|
"mocha": "^6.1.4",
|
||||||
|
|
|
@ -51,14 +51,14 @@ const operations = [
|
||||||
function findOrCreate_found(ds) {
|
function findOrCreate_found(ds) {
|
||||||
return ds.TestModel.findOrCreate(
|
return ds.TestModel.findOrCreate(
|
||||||
{where: {name: ds.existingInstance.name}},
|
{where: {name: ds.existingInstance.name}},
|
||||||
{name: ds.existingInstance.name}
|
{name: ds.existingInstance.name},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
function findOrCreate_create(ds) {
|
function findOrCreate_create(ds) {
|
||||||
return ds.TestModel.findOrCreate(
|
return ds.TestModel.findOrCreate(
|
||||||
{where: {name: 'new-record'}},
|
{where: {name: 'new-record'}},
|
||||||
{name: 'new-record'}
|
{name: 'new-record'},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ const operations = [
|
||||||
|
|
||||||
function updateOrCreate_update(ds) {
|
function updateOrCreate_update(ds) {
|
||||||
return ds.TestModel.updateOrCreate(
|
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) {
|
function replaceOrCreate_update(ds) {
|
||||||
return ds.TestModel.replaceOrCreate(
|
return ds.TestModel.replaceOrCreate(
|
||||||
{id: ds.existingInstance.id, name: 'new name'}
|
{id: ds.existingInstance.id, name: 'new name'},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
function replaceById(ds) {
|
function replaceById(ds) {
|
||||||
return ds.TestModel.replaceById(
|
return ds.TestModel.replaceById(
|
||||||
ds.existingInstance.id,
|
ds.existingInstance.id,
|
||||||
{name: 'new name'}
|
{name: 'new name'},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -322,7 +322,7 @@ describe('async observer', function() {
|
||||||
},
|
},
|
||||||
function(err) {
|
function(err) {
|
||||||
err.should.eql(testError);
|
err.should.eql(testError);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -127,10 +127,10 @@ describe('basic-querying', function() {
|
||||||
return u.name;
|
return u.name;
|
||||||
});
|
});
|
||||||
names.should.eql(
|
names.should.eql(
|
||||||
[createdUsers[2].name, createdUsers[1].name, createdUsers[0].name]
|
[createdUsers[2].name, createdUsers[1].name, createdUsers[0].name],
|
||||||
);
|
);
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -90,7 +90,7 @@ describe('crud-with-options', function() {
|
||||||
function(done) {
|
function(done) {
|
||||||
User.findById(undefined, {}, function(err, u) {
|
User.findById(undefined, {}, function(err, u) {
|
||||||
err.should.be.eql(
|
err.should.be.eql(
|
||||||
new Error('Model::findById requires the id argument')
|
new Error('Model::findById requires the id argument'),
|
||||||
);
|
);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
|
@ -376,7 +376,7 @@ describe('DataSource', function() {
|
||||||
const result = await ds.execute(
|
const result = await ds.execute(
|
||||||
'command',
|
'command',
|
||||||
['arg1', 'arg2'],
|
['arg1', 'arg2'],
|
||||||
{'a-flag': 'a-value'}
|
{'a-flag': 'a-value'},
|
||||||
);
|
);
|
||||||
|
|
||||||
result.should.be.equal('a-result');
|
result.should.be.equal('a-result');
|
||||||
|
|
|
@ -295,7 +295,7 @@ describe('datatypes', function() {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
persistUndefinedAsNull: true,
|
persistUndefinedAsNull: true,
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
isStrict = TestModel.definition.settings.strict;
|
isStrict = TestModel.definition.settings.strict;
|
||||||
|
@ -385,13 +385,13 @@ describe('datatypes', function() {
|
||||||
TestModel.modelName,
|
TestModel.modelName,
|
||||||
{where: {id: created.id}},
|
{where: {id: created.id}},
|
||||||
{},
|
{},
|
||||||
cb
|
cb,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
TestModel.dataSource.connector.all(
|
TestModel.dataSource.connector.all(
|
||||||
TestModel.modelName,
|
TestModel.modelName,
|
||||||
{where: {id: created.id}},
|
{where: {id: created.id}},
|
||||||
cb
|
cb,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -3,9 +3,6 @@
|
||||||
// This file is licensed under the MIT License.
|
// This file is licensed under the MIT License.
|
||||||
// License text available at https://opensource.org/licenses/MIT
|
// License text available at https://opensource.org/licenses/MIT
|
||||||
|
|
||||||
/* global describe,it */
|
|
||||||
/* jshint expr:true */
|
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
require('should');
|
require('should');
|
||||||
|
|
|
@ -80,7 +80,7 @@ describe('Memory connector with mocked discovery', function() {
|
||||||
const s = schemas['STRONGLOOP.INVENTORY'];
|
const s = schemas['STRONGLOOP.INVENTORY'];
|
||||||
s.name.should.be.eql('Inventory');
|
s.name.should.be.eql('Inventory');
|
||||||
Object.keys(s.properties).should.be.eql(
|
Object.keys(s.properties).should.be.eql(
|
||||||
['productId', 'locationId', 'available', 'total']
|
['productId', 'locationId', 'available', 'total'],
|
||||||
);
|
);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
@ -98,7 +98,7 @@ describe('Memory connector with mocked discovery', function() {
|
||||||
const s = schemas['STRONGLOOP.INVENTORY'];
|
const s = schemas['STRONGLOOP.INVENTORY'];
|
||||||
s.name.should.be.eql('inventory');
|
s.name.should.be.eql('inventory');
|
||||||
Object.keys(s.properties).should.be.eql(
|
Object.keys(s.properties).should.be.eql(
|
||||||
['product_id', 'location_id', 'available', 'total']
|
['product_id', 'location_id', 'available', 'total'],
|
||||||
);
|
);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
@ -112,7 +112,7 @@ describe('Memory connector with mocked discovery', function() {
|
||||||
const s = schemas['STRONGLOOP.INVENTORY'];
|
const s = schemas['STRONGLOOP.INVENTORY'];
|
||||||
s.name.should.be.eql('INVENTORY');
|
s.name.should.be.eql('INVENTORY');
|
||||||
Object.keys(s.properties).should.be.eql(
|
Object.keys(s.properties).should.be.eql(
|
||||||
['PRODUCT_ID', 'LOCATION_ID', 'AVAILABLE', 'TOTAL']
|
['PRODUCT_ID', 'LOCATION_ID', 'AVAILABLE', 'TOTAL'],
|
||||||
);
|
);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
@ -172,7 +172,7 @@ describe('Memory connector with mocked discovery', function() {
|
||||||
s.name.should.be.eql('Inventory');
|
s.name.should.be.eql('Inventory');
|
||||||
|
|
||||||
Object.keys(s.properties).should.be.eql(
|
Object.keys(s.properties).should.be.eql(
|
||||||
['productId', 'locationId', 'available', 'total']
|
['productId', 'locationId', 'available', 'total'],
|
||||||
);
|
);
|
||||||
done();
|
done();
|
||||||
})
|
})
|
||||||
|
@ -312,7 +312,7 @@ describe('discoverModelDefinitions', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
tableNames.should.be.eql(
|
tableNames.should.be.eql(
|
||||||
['CUSTOMER', 'INVENTORY', 'LOCATION']
|
['CUSTOMER', 'INVENTORY', 'LOCATION'],
|
||||||
);
|
);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
@ -327,7 +327,7 @@ describe('discoverModelDefinitions', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
tableNames.should.be.eql(
|
tableNames.should.be.eql(
|
||||||
['CUSTOMER', 'INVENTORY', 'LOCATION']
|
['CUSTOMER', 'INVENTORY', 'LOCATION'],
|
||||||
);
|
);
|
||||||
done();
|
done();
|
||||||
};
|
};
|
||||||
|
@ -343,7 +343,7 @@ describe('discoverModelDefinitions', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
tableNames.should.be.eql(
|
tableNames.should.be.eql(
|
||||||
['CUSTOMER', 'INVENTORY', 'LOCATION']
|
['CUSTOMER', 'INVENTORY', 'LOCATION'],
|
||||||
);
|
);
|
||||||
done();
|
done();
|
||||||
})
|
})
|
||||||
|
|
|
@ -3,9 +3,6 @@
|
||||||
// This file is licensed under the MIT License.
|
// This file is licensed under the MIT License.
|
||||||
// License text available at https://opensource.org/licenses/MIT
|
// License text available at https://opensource.org/licenses/MIT
|
||||||
|
|
||||||
/* global describe,it */
|
|
||||||
/* jshint expr:true */
|
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
require('should');
|
require('should');
|
||||||
|
|
|
@ -411,7 +411,7 @@ describe('hooks', function() {
|
||||||
it('should describe isValid sequence', function(done) {
|
it('should describe isValid sequence', function(done) {
|
||||||
should.not.exist(
|
should.not.exist(
|
||||||
user.constructor._validations,
|
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) {
|
user.isValid(function(valid) {
|
||||||
valid.should.be.true;
|
valid.should.be.true;
|
||||||
|
|
|
@ -1596,7 +1596,7 @@ function setup(done) {
|
||||||
createdUsers = items;
|
createdUsers = items;
|
||||||
createPassports();
|
createPassports();
|
||||||
createAccessTokens();
|
createAccessTokens();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
function createAccessTokens() {
|
function createAccessTokens() {
|
||||||
|
@ -1606,7 +1606,7 @@ function setup(done) {
|
||||||
{token: '1', userId: createdUsers[0].id},
|
{token: '1', userId: createdUsers[0].id},
|
||||||
{token: '2', userId: createdUsers[1].id},
|
{token: '2', userId: createdUsers[1].id},
|
||||||
],
|
],
|
||||||
function(items) {}
|
function(items) {},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1622,7 +1622,7 @@ function setup(done) {
|
||||||
function(items) {
|
function(items) {
|
||||||
createdPassports = items;
|
createdPassports = items;
|
||||||
createPosts();
|
createPosts();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1637,7 +1637,7 @@ function setup(done) {
|
||||||
function(items) {
|
function(items) {
|
||||||
createdProfiles = items;
|
createdProfiles = items;
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1654,7 +1654,7 @@ function setup(done) {
|
||||||
function(items) {
|
function(items) {
|
||||||
createdPosts = items;
|
createdPosts = items;
|
||||||
createProfiles();
|
createProfiles();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -31,7 +31,7 @@ function givenKeys(Model, keys, cb) {
|
||||||
let p = Promise.all(
|
let p = Promise.all(
|
||||||
keys.map(function(k) {
|
keys.map(function(k) {
|
||||||
return Model.set(k, 'value-' + k);
|
return Model.set(k, 'value-' + k);
|
||||||
})
|
}),
|
||||||
);
|
);
|
||||||
if (cb) {
|
if (cb) {
|
||||||
p = p.then(function(r) { cb(null, r); }, cb);
|
p = p.then(function(r) { cb(null, r); }, cb);
|
||||||
|
|
|
@ -53,7 +53,7 @@ module.exports = function(dataSourceFactory, connectorCapabilities) {
|
||||||
function(err) {
|
function(err) {
|
||||||
err.message.should.match(/expired-key/);
|
err.message.should.match(/expired-key/);
|
||||||
err.should.have.property('statusCode', 404);
|
err.should.have.property('statusCode', 404);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ module.exports = function(dataSourceFactory, connectorCapabilities) {
|
||||||
function(err) {
|
function(err) {
|
||||||
err.message.should.match(/key-does-not-exist/);
|
err.message.should.match(/key-does-not-exist/);
|
||||||
err.should.have.property('statusCode', 404);
|
err.should.have.property('statusCode', 404);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ module.exports = function(dataSourceFactory, connectorCapabilities) {
|
||||||
it('gets TTL when key with unexpired TTL exists - Promise API',
|
it('gets TTL when key with unexpired TTL exists - Promise API',
|
||||||
function() {
|
function() {
|
||||||
return Promise.resolve(
|
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(() => helpers.delay(SMALL_DELAY))
|
||||||
.then(function() { return CacheItem.ttl('a-key'); })
|
.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() {
|
it('fails when getting TTL for a key with expired TTL', function() {
|
||||||
return Promise.resolve(
|
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(() => helpers.delay(2 * TTL_PRECISION))
|
||||||
.then(function() {
|
.then(function() {
|
||||||
|
@ -68,7 +68,7 @@ module.exports = function(dataSourceFactory, connectorCapabilities) {
|
||||||
function(err) {
|
function(err) {
|
||||||
err.message.should.match(/expired-key/);
|
err.message.should.match(/expired-key/);
|
||||||
err.should.have.property('statusCode', 404);
|
err.should.have.property('statusCode', 404);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ module.exports = function(dataSourceFactory, connectorCapabilities) {
|
||||||
function(err) {
|
function(err) {
|
||||||
err.message.should.match(/key-does-not-exist/);
|
err.message.should.match(/key-does-not-exist/);
|
||||||
err.should.have.property('statusCode', 404);
|
err.should.have.property('statusCode', 404);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -749,10 +749,10 @@ describe('Model loaded with a base', function() {
|
||||||
Customer1.definition.properties.should.have.property('name');
|
Customer1.definition.properties.should.have.property('name');
|
||||||
Customer2.definition.properties.should.have.property('name');
|
Customer2.definition.properties.should.have.property('name');
|
||||||
Customer1.definition.properties.name.should.not.be.equal(
|
Customer1.definition.properties.name.should.not.be.equal(
|
||||||
Customer2.definition.properties.name
|
Customer2.definition.properties.name,
|
||||||
);
|
);
|
||||||
Customer1.definition.properties.name.should.eql(
|
Customer1.definition.properties.name.should.eql(
|
||||||
Customer2.definition.properties.name
|
Customer2.definition.properties.name,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -364,7 +364,7 @@ describe('manipulation', function() {
|
||||||
should.equal(result.gender, null);
|
should.equal(result.gender, null);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -942,9 +942,9 @@ describe('manipulation', function() {
|
||||||
should.equal(result.gender, null);
|
should.equal(result.gender, null);
|
||||||
|
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -991,7 +991,7 @@ describe('manipulation', function() {
|
||||||
function(err, inst) {
|
function(err, inst) {
|
||||||
if (err) return done(err);
|
if (err) return done(err);
|
||||||
inst.save(done);
|
inst.save(done);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1654,7 +1654,7 @@ describe('manipulation', function() {
|
||||||
p.gender.should.equal('male');
|
p.gender.should.equal('male');
|
||||||
created.should.equal(false);
|
created.should.equal(false);
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1678,7 +1678,7 @@ describe('manipulation', function() {
|
||||||
it('should find a record if exists (promise variant)', function(done) {
|
it('should find a record if exists (promise variant)', function(done) {
|
||||||
Person.findOrCreate(
|
Person.findOrCreate(
|
||||||
{where: {name: 'Jed'}},
|
{where: {name: 'Jed'}},
|
||||||
{name: 'Jed', gender: 'male'}
|
{name: 'Jed', gender: 'male'},
|
||||||
)
|
)
|
||||||
.then(function(res) {
|
.then(function(res) {
|
||||||
res.should.be.instanceOf(Array);
|
res.should.be.instanceOf(Array);
|
||||||
|
@ -2489,7 +2489,7 @@ describe('manipulation', function() {
|
||||||
should.equal(result.city, null);
|
should.equal(result.city, null);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -406,7 +406,7 @@ describe('ModelDefinition class', function() {
|
||||||
return Child.update({name: 'childA'}, {secret: 'new-secret'}, optionsFromRemoteReq).then(
|
return Child.update({name: 'childA'}, {secret: 'new-secret'}, optionsFromRemoteReq).then(
|
||||||
function(result) {
|
function(result) {
|
||||||
result.count.should.equal(1);
|
result.count.should.equal(1);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -292,6 +292,6 @@ function seed(User, done) {
|
||||||
async.each(beatles, User.create.bind(User), cb);
|
async.each(beatles, User.create.bind(User), cb);
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
done
|
done,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,7 +72,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
function(err, result) {
|
function(err, result) {
|
||||||
if (err) reject(err);
|
if (err) reject(err);
|
||||||
else resolve(result);
|
else resolve(result);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,7 +73,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
function(err, result) {
|
function(err, result) {
|
||||||
if (err) reject(err);
|
if (err) reject(err);
|
||||||
else resolve(result);
|
else resolve(result);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ describe('optional-validation', function() {
|
||||||
ModelWithForceId = db.createModel(
|
ModelWithForceId = db.createModel(
|
||||||
'ModelWithForceId',
|
'ModelWithForceId',
|
||||||
{name: String},
|
{name: String},
|
||||||
{forceId: true}
|
{forceId: true},
|
||||||
);
|
);
|
||||||
User = db.define('User', {
|
User = db.define('User', {
|
||||||
seq: {type: Number, index: true},
|
seq: {type: Number, index: true},
|
||||||
|
|
|
@ -109,7 +109,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
'loaded',
|
'loaded',
|
||||||
]);
|
]);
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -137,7 +137,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
if (err) return done(err);
|
if (err) return done(err);
|
||||||
hookMonitor.names.should.be.empty();
|
hookMonitor.names.should.be.empty();
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -243,7 +243,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
if (err) return done(err);
|
if (err) return done(err);
|
||||||
hookMonitor.names.should.be.empty();
|
hookMonitor.names.should.be.empty();
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -342,7 +342,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
|
|
||||||
list[0].should.have.property('extra', 'hook data');
|
list[0].should.have.property('extra', 'hook data');
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -353,7 +353,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
function(err, list) {
|
function(err, list) {
|
||||||
[err].should.eql([expectedError]);
|
[err].should.eql([expectedError]);
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -374,7 +374,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
'after save',
|
'after save',
|
||||||
]);
|
]);
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -451,7 +451,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
}),
|
}),
|
||||||
]);
|
]);
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -480,7 +480,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -514,7 +514,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
});
|
});
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -537,7 +537,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -548,7 +548,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
function(err, instance) {
|
function(err, instance) {
|
||||||
[err].should.eql([expectedError]);
|
[err].should.eql([expectedError]);
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -570,7 +570,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
|
|
||||||
instance.should.have.property('extra', 'hook data');
|
instance.should.have.property('extra', 'hook data');
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -636,7 +636,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
}),
|
}),
|
||||||
]);
|
]);
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -666,7 +666,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
isNewInstance: true,
|
isNewInstance: true,
|
||||||
}));
|
}));
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -687,7 +687,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
skip: 0,
|
skip: 0,
|
||||||
}}));
|
}}));
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -710,7 +710,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
isNewInstance: true,
|
isNewInstance: true,
|
||||||
}));
|
}));
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -732,7 +732,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
isNewInstance: true,
|
isNewInstance: true,
|
||||||
}));
|
}));
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -746,7 +746,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
(err || {}).should.be.instanceOf(ValidationError);
|
(err || {}).should.be.instanceOf(ValidationError);
|
||||||
(err.details.codes || {}).should.eql({name: ['presence']});
|
(err.details.codes || {}).should.eql({name: ['presence']});
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -766,7 +766,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
'after save',
|
'after save',
|
||||||
]);
|
]);
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -793,7 +793,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -806,7 +806,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
function(err, instance) {
|
function(err, instance) {
|
||||||
[err].should.eql([expectedError]);
|
[err].should.eql([expectedError]);
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -819,7 +819,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
function(err, instance) {
|
function(err, instance) {
|
||||||
[err].should.eql([expectedError]);
|
[err].should.eql([expectedError]);
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -856,7 +856,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -897,7 +897,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -932,7 +932,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
});
|
});
|
||||||
|
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -972,7 +972,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1000,7 +1000,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1023,7 +1023,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1035,7 +1035,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
function(err, instance) {
|
function(err, instance) {
|
||||||
[err].should.eql([expectedError]);
|
[err].should.eql([expectedError]);
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1055,7 +1055,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
instance.should.have.property('extra', 'hook data');
|
instance.should.have.property('extra', 'hook data');
|
||||||
|
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1082,7 +1082,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
|
|
||||||
instance.should.have.property('extra', 'hook data');
|
instance.should.have.property('extra', 'hook data');
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1103,7 +1103,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
isNewInstance: true,
|
isNewInstance: true,
|
||||||
}));
|
}));
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1117,7 +1117,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
if (err) return done(err);
|
if (err) return done(err);
|
||||||
ctxRecorder.records.should.eql('hook not called');
|
ctxRecorder.records.should.eql('hook not called');
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -1163,7 +1163,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
'after save',
|
'after save',
|
||||||
]);
|
]);
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1282,7 +1282,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
function(err, instance) {
|
function(err, instance) {
|
||||||
[err].should.eql([expectedError]);
|
[err].should.eql([expectedError]);
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1326,7 +1326,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
// PersistedModel.create and force it to call connector.save()
|
// PersistedModel.create and force it to call connector.save()
|
||||||
const instance = new TestModel(
|
const instance = new TestModel(
|
||||||
{id: 'new-id', name: 'created'},
|
{id: 'new-id', name: 'created'},
|
||||||
{persisted: true}
|
{persisted: true},
|
||||||
);
|
);
|
||||||
|
|
||||||
instance.save(function(err, instance) {
|
instance.save(function(err, instance) {
|
||||||
|
@ -1383,7 +1383,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
'after save',
|
'after save',
|
||||||
]);
|
]);
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1544,7 +1544,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
});
|
});
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -1581,7 +1581,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
function(err, instance) {
|
function(err, instance) {
|
||||||
[err].should.eql([expectedError]);
|
[err].should.eql([expectedError]);
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1663,7 +1663,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
'after save',
|
'after save',
|
||||||
]);
|
]);
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1807,7 +1807,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
});
|
});
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -1836,7 +1836,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
function(err, instance) {
|
function(err, instance) {
|
||||||
[err].should.eql([expectedError]);
|
[err].should.eql([expectedError]);
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1912,7 +1912,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
'after save',
|
'after save',
|
||||||
]);
|
]);
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1931,7 +1931,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
'after save',
|
'after save',
|
||||||
]);
|
]);
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1946,7 +1946,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
where: {id: 'not-found'},
|
where: {id: 'not-found'},
|
||||||
}}));
|
}}));
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1961,7 +1961,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
where: {id: existingInstance.id},
|
where: {id: existingInstance.id},
|
||||||
}}));
|
}}));
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1974,7 +1974,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
if (err) return done(err);
|
if (err) return done(err);
|
||||||
ctxRecorder.records.should.equal('hook not called');
|
ctxRecorder.records.should.equal('hook not called');
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1996,7 +1996,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
]);
|
]);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -2019,7 +2019,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
]);
|
]);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -2037,7 +2037,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
if (err) return done(err);
|
if (err) return done(err);
|
||||||
hookMonitor.names.should.eql(['access', 'before save']);
|
hookMonitor.names.should.eql(['access', 'before save']);
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -2067,7 +2067,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -2097,7 +2097,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
}
|
}
|
||||||
|
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -2114,7 +2114,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
if (err) return done(err);
|
if (err) return done(err);
|
||||||
instance.name.should.equal('hooked');
|
instance.name.should.equal('hooked');
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -2135,7 +2135,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
if (err) return done(err);
|
if (err) return done(err);
|
||||||
instance.name.should.equal('hooked');
|
instance.name.should.equal('hooked');
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -2150,7 +2150,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
(err || {}).should.be.instanceOf(ValidationError);
|
(err || {}).should.be.instanceOf(ValidationError);
|
||||||
(err.details.codes || {}).should.eql({name: ['presence']});
|
(err.details.codes || {}).should.eql({name: ['presence']});
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -2165,7 +2165,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
(err || {}).should.be.instanceOf(ValidationError);
|
(err || {}).should.be.instanceOf(ValidationError);
|
||||||
(err.details.codes || {}).should.eql({name: ['presence']});
|
(err.details.codes || {}).should.eql({name: ['presence']});
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -2202,7 +2202,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -2235,7 +2235,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
|
|
||||||
ctxRecorder.records.should.eql(expectedContext);
|
ctxRecorder.records.should.eql(expectedContext);
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -2262,7 +2262,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -2281,7 +2281,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
isNewInstance: isNewInstanceFlag ? false : undefined,
|
isNewInstance: isNewInstanceFlag ? false : undefined,
|
||||||
}));
|
}));
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -2292,7 +2292,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
function(err, instance) {
|
function(err, instance) {
|
||||||
[err].should.eql([expectedError]);
|
[err].should.eql([expectedError]);
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -2312,7 +2312,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
isNewInstance: isNewInstanceFlag ? false : undefined,
|
isNewInstance: isNewInstanceFlag ? false : undefined,
|
||||||
}));
|
}));
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -2343,7 +2343,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
isNewInstance: isNewInstanceFlag ? true : undefined,
|
isNewInstance: isNewInstanceFlag ? true : undefined,
|
||||||
}));
|
}));
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -2367,7 +2367,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
'after save',
|
'after save',
|
||||||
]);
|
]);
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -2386,7 +2386,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
'after save',
|
'after save',
|
||||||
]);
|
]);
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -2401,7 +2401,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
where: {id: 'not-found'},
|
where: {id: 'not-found'},
|
||||||
}}));
|
}}));
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -2416,7 +2416,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
where: {id: existingInstance.id},
|
where: {id: existingInstance.id},
|
||||||
}}));
|
}}));
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -2429,7 +2429,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
if (err) return done(err);
|
if (err) return done(err);
|
||||||
ctxRecorder.records.should.equal('hook not called');
|
ctxRecorder.records.should.equal('hook not called');
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -2451,7 +2451,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
]);
|
]);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -2474,7 +2474,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
]);
|
]);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -2492,7 +2492,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
if (err) return done(err);
|
if (err) return done(err);
|
||||||
hookMonitor.names.should.eql(['access', 'before save']);
|
hookMonitor.names.should.eql(['access', 'before save']);
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -2535,7 +2535,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
ctxRecorder.records.should.eql(expectedContext);
|
ctxRecorder.records.should.eql(expectedContext);
|
||||||
|
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -2561,7 +2561,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
ctxRecorder.records.should.eql(expectedContext);
|
ctxRecorder.records.should.eql(expectedContext);
|
||||||
|
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -2577,7 +2577,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
if (err) return done(err);
|
if (err) return done(err);
|
||||||
instance.name.should.equal('hooked');
|
instance.name.should.equal('hooked');
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -2590,7 +2590,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
(err || {}).should.be.instanceOf(ValidationError);
|
(err || {}).should.be.instanceOf(ValidationError);
|
||||||
(err.details.codes || {}).should.eql({name: ['presence']});
|
(err.details.codes || {}).should.eql({name: ['presence']});
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -2624,7 +2624,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
}
|
}
|
||||||
ctxRecorder.records.should.eql(expectedContext);
|
ctxRecorder.records.should.eql(expectedContext);
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -2657,7 +2657,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
|
|
||||||
ctxRecorder.records.should.eql(expectedContext);
|
ctxRecorder.records.should.eql(expectedContext);
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -2684,7 +2684,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
found.should.have.property('extra', 'hook data');
|
found.should.have.property('extra', 'hook data');
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -2730,7 +2730,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
|
|
||||||
ctxRecorder.records.should.eql(aCtxForModel(TestModel, expected));
|
ctxRecorder.records.should.eql(aCtxForModel(TestModel, expected));
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -2755,7 +2755,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
|
|
||||||
ctxRecorder.records.should.eql(aCtxForModel(TestModel, expected));
|
ctxRecorder.records.should.eql(aCtxForModel(TestModel, expected));
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -2766,7 +2766,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
function(err, instance) {
|
function(err, instance) {
|
||||||
[err].should.eql([expectedError]);
|
[err].should.eql([expectedError]);
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -2792,7 +2792,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
|
|
||||||
ctxRecorder.records.should.eql(aCtxForModel(TestModel, expected));
|
ctxRecorder.records.should.eql(aCtxForModel(TestModel, expected));
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -2817,7 +2817,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
|
|
||||||
ctxRecorder.records.should.eql(aCtxForModel(TestModel, expected));
|
ctxRecorder.records.should.eql(aCtxForModel(TestModel, expected));
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -2843,7 +2843,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
'after save',
|
'after save',
|
||||||
]);
|
]);
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -2884,7 +2884,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
|
|
||||||
ctxRecorder.records.should.eql(expectedContext);
|
ctxRecorder.records.should.eql(expectedContext);
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -2906,7 +2906,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
found.should.have.property('extra', 'hook data');
|
found.should.have.property('extra', 'hook data');
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -3105,7 +3105,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
TestModel.findById(existingInstance.id, function(err, inst) {
|
TestModel.findById(existingInstance.id, function(err, inst) {
|
||||||
if (err) return done(err);
|
if (err) return done(err);
|
||||||
(inst ? inst.toObject() : 'null').should.eql(
|
(inst ? inst.toObject() : 'null').should.eql(
|
||||||
existingInstance.toObject()
|
existingInstance.toObject(),
|
||||||
);
|
);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
@ -3204,7 +3204,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
where: {name: 'searched'},
|
where: {name: 'searched'},
|
||||||
}}));
|
}}));
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -3227,7 +3227,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
]);
|
]);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -3244,7 +3244,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
data: {name: 'updated'},
|
data: {name: 'updated'},
|
||||||
}));
|
}));
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -3265,7 +3265,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
instance.should.have.property('extra', 'added');
|
instance.should.have.property('extra', 'added');
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -3284,7 +3284,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -3303,7 +3303,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
instance.should.have.property('extra', 'hook data');
|
instance.should.have.property('extra', 'hook data');
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -3317,7 +3317,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
if (err) return done(err);
|
if (err) return done(err);
|
||||||
ctxRecorder.records.should.eql('hook not called');
|
ctxRecorder.records.should.eql('hook not called');
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -3335,7 +3335,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
info: {count: 1},
|
info: {count: 1},
|
||||||
}));
|
}));
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -3352,7 +3352,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
|
||||||
foo: 'bar',
|
foo: 'bar',
|
||||||
});
|
});
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -2612,7 +2612,7 @@ describe('relations', function() {
|
||||||
const actual = pics.map(
|
const actual = pics.map(
|
||||||
function(pic) {
|
function(pic) {
|
||||||
return {imageName: pic.name, name: pic.imageable().name};
|
return {imageName: pic.name, name: pic.imageable().name};
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
actual.should.containDeep([
|
actual.should.containDeep([
|
||||||
|
@ -6228,7 +6228,7 @@ describe('relations', function() {
|
||||||
err.name.should.equal('ValidationError');
|
err.name.should.equal('ValidationError');
|
||||||
err.details.codes.jobs.should.eql(['uniqueness']);
|
err.details.codes.jobs.should.eql(['uniqueness']);
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -6616,7 +6616,7 @@ describe('relations', function() {
|
||||||
type: 'hasMany',
|
type: 'hasMany',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
}).should.throw('Invalid relation name: trigger');
|
}).should.throw('Invalid relation name: trigger');
|
||||||
});
|
});
|
||||||
|
|
|
@ -54,7 +54,7 @@ exports.init = function init(external_exports) {
|
||||||
function check_external_exports() {
|
function check_external_exports() {
|
||||||
if (!EXT_EXP) throw new Error(
|
if (!EXT_EXP) throw new Error(
|
||||||
'Before run this, please ensure that ' +
|
'Before run this, please ensure that ' +
|
||||||
'require("spec_helper").init(exports); called'
|
'require("spec_helper").init(exports); called',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -88,13 +88,13 @@ describe('util.sanitizeQuery', function() {
|
||||||
const q7 = {where: {x: 1}};
|
const q7 = {where: {x: 1}};
|
||||||
q7.where.y = q7;
|
q7.where.y = q7;
|
||||||
(function() { sanitizeQuery(q7); }).should.throw(
|
(function() { sanitizeQuery(q7); }).should.throw(
|
||||||
/The query object is circular/
|
/The query object is circular/,
|
||||||
);
|
);
|
||||||
|
|
||||||
const q8 = {where: {and: [{and: [{and: [{and: [{and: [{and:
|
const q8 = {where: {and: [{and: [{and: [{and: [{and: [{and:
|
||||||
[{and: [{and: [{and: [{x: 1}]}]}]}]}]}]}]}]}]}};
|
[{and: [{and: [{and: [{x: 1}]}]}]}]}]}]}]}]}]}};
|
||||||
(function() { sanitizeQuery(q8, {maxDepth: 12}); }).should.throw(
|
(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
|
// maxDepth is default to maximum integer
|
||||||
|
@ -102,7 +102,7 @@ describe('util.sanitizeQuery', function() {
|
||||||
|
|
||||||
const q9 = {where: {and: [{and: [{and: [{and: [{x: 1}]}]}]}]}};
|
const q9 = {where: {and: [{and: [{and: [{and: [{x: 1}]}]}]}]}};
|
||||||
(function() { sanitizeQuery(q8, {maxDepth: 4}); }).should.throw(
|
(function() { sanitizeQuery(q8, {maxDepth: 4}); }).should.throw(
|
||||||
/The query object exceeds maximum depth 4/
|
/The query object exceeds maximum depth 4/,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -348,7 +348,7 @@ describe('validations', function() {
|
||||||
if (options.testFlag !== 'someValue') {
|
if (options.testFlag !== 'someValue') {
|
||||||
console.error(
|
console.error(
|
||||||
'Unexpected validation options: %j Expected %j',
|
'Unexpected validation options: %j Expected %j',
|
||||||
options, {testFlag: 'someValue'}
|
options, {testFlag: 'someValue'},
|
||||||
);
|
);
|
||||||
err();
|
err();
|
||||||
}
|
}
|
||||||
|
@ -609,13 +609,13 @@ describe('validations', function() {
|
||||||
function createSite1User(next) {
|
function createSite1User(next) {
|
||||||
SiteUser.create(
|
SiteUser.create(
|
||||||
{siteId: 1, email: EMAIL},
|
{siteId: 1, email: EMAIL},
|
||||||
next
|
next,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
function createSite2User(user1, next) {
|
function createSite2User(user1, next) {
|
||||||
SiteUser.create(
|
SiteUser.create(
|
||||||
{siteId: 2, email: EMAIL},
|
{siteId: 2, email: EMAIL},
|
||||||
next
|
next,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
function validateDuplicateUser(user2, next) {
|
function validateDuplicateUser(user2, next) {
|
||||||
|
@ -1424,7 +1424,7 @@ describe('validations', function() {
|
||||||
obj.email = 'test@example.com';
|
obj.email = 'test@example.com';
|
||||||
const err = givenValidationError('user', obj, 'is invalid');
|
const err = givenValidationError('user', obj, 'is invalid');
|
||||||
getErrorDetails(err).should.equal(
|
getErrorDetails(err).should.equal(
|
||||||
'`user` is invalid (value: { email: \'test@example.com\' }).'
|
'`user` is invalid (value: { email: \'test@example.com\' }).',
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue