Fix `deleteById(id)` and other test failures
This commit is contained in:
parent
b4189bf997
commit
46ff76dda0
|
@ -1284,6 +1284,10 @@ DataAccessObject.removeById = DataAccessObject.destroyById = DataAccessObject.de
|
|||
options = {};
|
||||
}
|
||||
}
|
||||
|
||||
options = options || {};
|
||||
cb = cb || noCallback;
|
||||
|
||||
assert(typeof options === 'object', 'The options argument must be an object');
|
||||
assert(typeof cb === 'function', 'The cb argument must be a function');
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ describe('crud-with-options', function () {
|
|||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
describe('findByIds', function () {
|
||||
|
||||
before(function(done) {
|
||||
|
@ -353,6 +353,12 @@ describe('crud-with-options', function () {
|
|||
|
||||
});
|
||||
|
||||
describe('deleteById', function() {
|
||||
it('should allow deleteById(id)', function () {
|
||||
User.deleteById(1);
|
||||
});
|
||||
});
|
||||
|
||||
describe('updateAll ', function () {
|
||||
|
||||
beforeEach(seed);
|
||||
|
|
|
@ -14,17 +14,13 @@ describe('events', function() {
|
|||
});
|
||||
});
|
||||
this.shouldEmitEvent = function(eventName, listener, done) {
|
||||
var timeout = setTimeout(function() {
|
||||
done(new Error('did not emit ' + eventName));
|
||||
}, 100);
|
||||
this.TestModel.on(eventName, function() {
|
||||
clearTimeout(timeout);
|
||||
listener.apply(this, arguments);
|
||||
done();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
describe('changed', function() {
|
||||
it('should be emitted after save', function(done) {
|
||||
var model = new this.TestModel({name: 'foobar'});
|
||||
|
@ -50,7 +46,7 @@ describe('events', function() {
|
|||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
describe('deleted', function() {
|
||||
it('should be emitted after destroy', function(done) {
|
||||
this.shouldEmitEvent('deleted', assertValidDeletedArgs, done);
|
||||
|
@ -61,7 +57,7 @@ describe('events', function() {
|
|||
this.TestModel.deleteById(this.inst.id);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
describe('deletedAll', function() {
|
||||
it('should be emitted after destroyAll', function(done) {
|
||||
this.shouldEmitEvent('deletedAll', function(where) {
|
||||
|
@ -78,4 +74,4 @@ function assertValidChangedArgs(obj) {
|
|||
|
||||
function assertValidDeletedArgs(id) {
|
||||
id.should.be.ok;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue