diff --git a/should-promised/should-promised-tests.ts b/should-promised/should-promised-tests.ts new file mode 100644 index 0000000000..03167e663f --- /dev/null +++ b/should-promised/should-promised-tests.ts @@ -0,0 +1,21 @@ +/// +/// +/// + +var promise: Promise = new Promise(function (resolve, reject) {}); + +promise.should.be.Promise; +(10).should.not.be.a.Promise; + +promise.should.be.fulfilled; + +promise.should.be.rejected; + +promise.should.be.rejectedWith(Error); +promise.should.be.rejectedWith('boom'); +promise.should.be.rejectedWith(/boom/); +promise.should.be.rejectedWith(Error, { message: 'boom' }); +promise.should.be.rejectedWith({ message: 'boom' }); + +promise.should.be.eventually.equal(10); +promise.should.be.finally.equal(10); diff --git a/should-promised/should-promised.d.ts b/should-promised/should-promised.d.ts new file mode 100644 index 0000000000..c6c95ba989 --- /dev/null +++ b/should-promised/should-promised.d.ts @@ -0,0 +1,14 @@ +// Type definitions for should-promised +// Project: https://github.com/shouldjs/promised +// Definitions by: Yaroslav Admin +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +interface ShouldAssertion { + Promise: ShouldAssertion; + fulfilled: ShouldAssertion; + rejected: ShouldAssertion; + rejectedWith(message: (string | Function | RegExp), properties?: Object): ShouldAssertion; + rejectedWith(message: Object): ShouldAssertion; + finally: ShouldAssertion; + eventually: ShouldAssertion; +}