不要怂,就是干,撸起袖子干!

Commit 99bb8d65 by Mick Hansen

remove broken events tests and on event in query chainer

1 parent c95477bf
......@@ -182,11 +182,6 @@ module.exports = (function() {
self.finishedEmits++;
self.fails.push(err);
finish.call(self, 'emitterResults');
})
.on('sql', function(sql) {
if (self.eventEmitter) {
self.eventEmitter.emit('sql', sql);
}
});
};
......
......@@ -324,105 +324,4 @@ describe(Support.getTestDialectTeaser('Promise'), function() {
});
});
});
describe('backwards compat', function() {
it('should still work with .complete() when resolving', function(done) {
var spy = sinon.spy()
, promise = new SequelizePromise(function(resolve, reject) {
resolve('abc');
});
promise.complete(spy);
promise.then(function() {
expect(spy.calledOnce).to.be.true;
expect(spy.firstCall.args).to.deep.equal([null, 'abc']);
done();
});
});
it('should still work with .success() when resolving', function(done) {
var spy = sinon.spy()
, promise = new SequelizePromise(function(resolve, reject) {
resolve('yay');
});
promise.success(spy);
promise.then(function() {
expect(spy.calledOnce).to.be.true;
expect(spy.firstCall.args).to.deep.equal(['yay']);
done();
});
});
it('should still work with then when resolving', function(done) {
var spy = sinon.spy()
, promise = new SequelizePromise(function(resolve, reject) {
resolve('yoohoo');
});
promise.then(spy);
promise.then(function() {
expect(spy.calledOnce).to.be.true;
expect(spy.firstCall.args).to.deep.equal(['yoohoo']);
done();
});
});
it('should still work with .done() when resolving multiple results', function(done) {
var spy = sinon.spy()
, promise = new SequelizePromise(function(resolve, reject) {
resolve(SequelizePromise.all(['MyModel', true]));
});
promise.spread(spy);
promise.done(function(err, model, created) {
expect(model).to.equal('MyModel');
expect(created).to.be.true;
expect(spy.calledOnce).to.be.true;
expect(spy.firstCall.args).to.deep.equal(['MyModel', true]);
done();
});
});
it('should still work with .complete() after chaining', function() {
var promise = new SequelizePromise(function(resolve, reject) {
resolve('Heyo');
});
return promise.then(function(result) {
return result + '123';
}).complete(function(err, result) {
expect(err).not.to.be.ok;
expect(result).to.equal('Heyo123');
});
});
it('should still work with .done() when rejecting', function(done) {
var spy = sinon.spy()
, promise = new SequelizePromise(function(resolve, reject) {
reject(new Error('no'));
});
promise.done(spy);
promise.catch(function() {
expect(spy.calledOnce).to.be.true;
expect(spy.firstCall.args[0]).to.be.an.instanceof(Error);
done();
});
});
it('should still work with .error() when throwing', function(done) {
var spy = sinon.spy()
, promise = new SequelizePromise(function(resolve, reject) {
throw new Error('no');
});
promise.error(spy);
promise.catch(function() {
expect(spy.calledOnce).to.be.true;
expect(spy.firstCall.args[0]).to.be.an.instanceof(Error);
done();
});
});
});
});
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!