Open sbycrosz opened 8 years ago
Context: I'm testing a Promise created using PromiseKit
What I have now:
promise.then(^(id result){ expect(result).to.equal(expected); }).catch(^(NSError *error){ failure(error); }).finally(^(){ done(); });
which the lazy old me use as a macro
#define AssertPromise(promise, expected) promise.then(^(id result){ expect(result).to.equal(expected);}).catch(^(NSError *error){ failure(error);}).finally(^(){done();});
What I wanted (similar library in JS: https://github.com/domenic/chai-as-promised/):
expect(promise).to.be.resolvedAs(expected)
Currently I am stuck on implementing the match method of EXPMatcher since it expects a boolean, but then we need to wait until the promise get resolved.
Would this kind of api be possible? Any kind of direction would be nice :)
Cheers,
Context: I'm testing a Promise created using PromiseKit
What I have now:
which the lazy old me use as a macro
What I wanted (similar library in JS: https://github.com/domenic/chai-as-promised/):
Currently I am stuck on implementing the match method of EXPMatcher since it expects a boolean, but then we need to wait until the promise get resolved.
Would this kind of api be possible? Any kind of direction would be nice :)
Cheers,