I couldn't get the kata to resolve. So I checked out the original checkin (which should pass). Tests 2&3 don't work.
But pasting it into Chrome debugger, it works properly (as it should).
describe('extending a `Promise`', function() {
it('is possible', function() {
class MyPromise extends Promise {}
const promise = new MyPromise(resolve => resolve());
promise
.then(() => done())
.catch(e => done(new Error('Expected to resolve, but failed with: ' + e)));
});
it('must call `super()` in the constructor if it wants to inherit/specialize the behavior', function() {
// WARNING: this example doesn't fulfill the Liskov principle
class ResolvingPromise extends Promise {
constructor() {
super(resolve => resolve());
}
}
return new ResolvingPromise();
});
});
done = (retval) => `done ${retval}`
(retval) => `done ${retval}`
class MyPromise extends Promise {}
const promise = new MyPromise(resolve => resolve());
promise
.then(() => done())
.catch(e => done(new Error('Expected to resolve, but failed with: ' + e)));
I couldn't get the kata to resolve. So I checked out the original checkin (which should pass). Tests 2&3 don't work.
But pasting it into Chrome debugger, it works properly (as it should).
Test
Returns
In Chrome
Returns