Fix `deleteById(id)` and other test failures

This commit is contained in:
Miroslav Bajtoš 2015-02-13 09:34:40 -08:00
parent b4189bf997
commit 46ff76dda0
3 changed files with 15 additions and 9 deletions

View File

@ -1284,6 +1284,10 @@ DataAccessObject.removeById = DataAccessObject.destroyById = DataAccessObject.de
options = {}; options = {};
} }
} }
options = options || {};
cb = cb || noCallback;
assert(typeof options === 'object', 'The options argument must be an object'); assert(typeof options === 'object', 'The options argument must be an object');
assert(typeof cb === 'function', 'The cb argument must be a function'); assert(typeof cb === 'function', 'The cb argument must be a function');

View File

@ -353,6 +353,12 @@ describe('crud-with-options', function () {
}); });
describe('deleteById', function() {
it('should allow deleteById(id)', function () {
User.deleteById(1);
});
});
describe('updateAll ', function () { describe('updateAll ', function () {
beforeEach(seed); beforeEach(seed);

View File

@ -14,11 +14,7 @@ describe('events', function() {
}); });
}); });
this.shouldEmitEvent = function(eventName, listener, done) { this.shouldEmitEvent = function(eventName, listener, done) {
var timeout = setTimeout(function() {
done(new Error('did not emit ' + eventName));
}, 100);
this.TestModel.on(eventName, function() { this.TestModel.on(eventName, function() {
clearTimeout(timeout);
listener.apply(this, arguments); listener.apply(this, arguments);
done(); done();
}); });