Skip to content

Commit

Permalink
Tests that Promise.coroutine patch does not interfere with `Promise…
Browse files Browse the repository at this point in the history
….prototype.lastly`
  • Loading branch information
overlookmotel committed Sep 4, 2016
1 parent 1e447ce commit db1267d
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion test/methods/generators/coroutine.inc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* File required by coroutine.test.js + spawn.test.js
*/

/* global describe */
/* global describe, it */
// jshint esversion:6

// Export function to run tests
Expand Down Expand Up @@ -115,6 +115,17 @@ module.exports = function(u, co) {
}, undefined, {bindIndirect: true, expectedBindings: expectedBindings});
});

describe('patch leaves Promise.prototype.lastly patch in place', function() {
it(function() {
var fn = co(function*() {}); // jshint ignore:line
var p = fn();

if (!u.Promise.prototype.lastly.__wrapped) throw new Error('Patch has interfered with `.lastly` patch');

return p;
});
});

// TODO Find better way to do this with `handler` being passed into preFn
describe('generator code runs in context', function() {
describe('prior to yield', function() {
Expand Down

0 comments on commit db1267d

Please sign in to comment.