Skip to content

Commit

Permalink
Add test to cover the behavior of rejected promises
Browse files Browse the repository at this point in the history
  • Loading branch information
dentrado committed Feb 13, 2017
1 parent 492d53e commit 53dccd4
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/Immutable.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,16 @@ var getTestUtils = require("./TestUtils.js");
});
});

it("doesn't wrap the promise rejection reason", function() {
var reason = new Error('foo');
var promise = Promise.reject(reason);
var wrappedPromise = Immutable(promise);

wrappedPromise.catch(catchedReason => {
assert.strictEqual(reason, catchedReason, 'The promise rejection reason should be left untouched');
});
});

it("doesn't fail when a function is defined on Array.prototype", function() {
Array.prototype.veryEvilFunction = function() {};
Immutable([]);
Expand Down

0 comments on commit 53dccd4

Please sign in to comment.