| function shouldBe(actual, expected) { |
| throw new Error('bad value: ' + actual); |
| function shouldThrow(func, errorMessage) { |
| throw new Error('not thrown'); |
| if (String(error) !== errorMessage) |
| throw new Error(`bad error: ${String(error)}`); |
| return new Thenable(this.promise.then(fulfill, rejected)); |
| var fulfilled = new Thenable(Promise.reject(0)); |
| var rejected = new Thenable(Promise.resolve(42)); |
| Promise.prototype.finally.call(fulfilled, function () { counter++; }); |
| Promise.prototype.finally.call(rejected, function () { counter++; }); |
| shouldThrow(() => Promise.prototype.finally.call(32), `TypeError: |this| is not an object`); |