Fix bug in test

This test's description concerns the behavior of `Promise.all` when the
IteratorStep abstract operation fails due to an abrupt completion
returned by the iterator's `next` method. The test body did not actually
assert that functionality.

Update the test body to correctly define the requisite iterator and
assert that the specific error created is the one thrown from the
invocation of `Promise.all`
This commit is contained in:
Mike Pennisi 2015-06-22 22:15:04 -04:00
parent 12cc01484e
commit 6f2feb0157
1 changed files with 10 additions and 13 deletions

View File

@ -11,20 +11,17 @@ description: iterator.next throws, causing Promise.all to reject
---*/
var iterThrows = {};
Object.defineProperty(iterThrows, Symbol.iterator, {
get: function () {
return {
next: function () {
throw new Error("abrupt completion");
}
};
}
});
var error = new Test262Error();
iterThrows[Symbol.iterator] = function() {
return {
next: function () {
throw error;
}
};
};
Promise.all(iterThrows).then(function () {
$ERROR('Promise unexpectedly resolved: Promise.all(iterThrows) should throw TypeError');
},function (err) {
if (!(err instanceof TypeError)) {
$ERROR('Expected TypeError, got ' + err);
}
},function (reason) {
assert.sameValue(reason, error);
}).then($DONE,$DONE);