diff --git a/sinon-stub-promise/sinon-stub-promise-tests.ts b/sinon-stub-promise/sinon-stub-promise-tests.ts new file mode 100644 index 0000000000..56c20a18a9 --- /dev/null +++ b/sinon-stub-promise/sinon-stub-promise-tests.ts @@ -0,0 +1,13 @@ +/// +function testResolve() { + var promise = sinon.stub().returnsPromise(); + promise.resolves('test val'); +} + +function testReject() { + var promise = sinon.stub().returnsPromise(); + promise.rejects('test val'); +} + +testResolve(); +testReject(); diff --git a/sinon-stub-promise/sinon-stub-promise.d.ts b/sinon-stub-promise/sinon-stub-promise.d.ts new file mode 100644 index 0000000000..9b681a6c0c --- /dev/null +++ b/sinon-stub-promise/sinon-stub-promise.d.ts @@ -0,0 +1,17 @@ +// Type definitions for sinon-stub-promise v1.0.1 +// Project: https://github.com/substantial/sinon-stub-promise +// Definitions by: Thiago Temple +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module Sinon { + interface SinonPromise { + resolves(value?: any): void; + rejects(value?: any): void; + } + + interface SinonStub { + returnsPromise(): SinonPromise; + } +}