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

Commit 2068063e by Jan Aagaard Meier

Merge pull request #3906 from overlookmotel/promise-cls

Add CLS support to `nodeify` promise method
2 parents 493528af b551c422
Showing with 14 additions and 0 deletions
...@@ -41,6 +41,9 @@ shimCLS(Promise.prototype, 'reduce', [0]); ...@@ -41,6 +41,9 @@ shimCLS(Promise.prototype, 'reduce', [0]);
shimCLS(Promise.prototype, 'filter', [0]); shimCLS(Promise.prototype, 'filter', [0]);
shimCLS(Promise.prototype, 'each', [0]); shimCLS(Promise.prototype, 'each', [0]);
// Promisification
shimCLS(Promise.prototype, 'nodeify', [0]);
// Utility // Utility
shimCLS(Promise.prototype, 'tap', [0]); shimCLS(Promise.prototype, 'tap', [0]);
......
...@@ -317,6 +317,17 @@ if (current.dialect.supports.transactions) { ...@@ -317,6 +317,17 @@ if (current.dialect.supports.transactions) {
}); });
}); });
it('nodeify', function () {
var self = this;
return this.sequelize.transaction(function () {
var tid = self.ns.get('transaction').id;
return self.User.findAll().nodeify(function () {
expect(self.ns.get('transaction').id).to.be.ok;
expect(self.ns.get('transaction').id).to.equal(tid);
});
});
});
it('tap', function () { it('tap', function () {
var self = this; var self = this;
return this.sequelize.transaction(function () { return this.sequelize.transaction(function () {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!