babel/test/fixtures/traceur/PromiseThrowInResolve.js
2015-01-04 19:40:09 +11:00

16 lines
408 B
JavaScript

// Async.
var message = 'testing';
var throwInResolve = new Promise((resolve, reject) => {
resolve(42);
});
throwInResolve.then((v) => {
throw new Error(message);
}).catch(function(ex) {
// When catch() is used in testing, these asserts would
// not be called, just the done() to avoid timeout.
assert(ex instanceof Error);
assert(ex.toString().indexOf(message) !== -1);
done();
}).catch(done);