diff --git a/types/sinon/index.d.ts b/types/sinon/index.d.ts index 2056d7e384..a2a4b32c8d 100644 --- a/types/sinon/index.d.ts +++ b/types/sinon/index.d.ts @@ -102,7 +102,7 @@ declare namespace Sinon { interface SinonStub extends SinonSpy { resetBehavior(): void; resetHistory(): void; - usingPromise(promiseLibrary: any): void; + usingPromise(promiseLibrary: any): SinonStub; returns(obj: any): SinonStub; returnsArg(index: number): SinonStub; @@ -203,19 +203,19 @@ declare namespace Sinon { Date(year: number, month: number, day: number, hour: number, minute: number, second: number, ms: number): Date; restore(): void; - /** - * Simulate the user changing the system clock while your program is running. It changes the 'now' timestamp - * without affecting timers, intervals or immediates. - * @param now The new 'now' in unix milliseconds - */ - setSystemTime(now: number): void; - /** - * Simulate the user changing the system clock while your program is running. It changes the 'now' timestamp - * without affecting timers, intervals or immediates. - * @param now The new 'now' as a JavaScript Date - */ - setSystemTime(date: Date): void; - } + /** + * Simulate the user changing the system clock while your program is running. It changes the 'now' timestamp + * without affecting timers, intervals or immediates. + * @param now The new 'now' in unix milliseconds + */ + setSystemTime(now: number): void; + /** + * Simulate the user changing the system clock while your program is running. It changes the 'now' timestamp + * without affecting timers, intervals or immediates. + * @param now The new 'now' as a JavaScript Date + */ + setSystemTime(date: Date): void; + } interface SinonFakeTimersStatic { (): SinonFakeTimers; @@ -415,7 +415,7 @@ declare namespace Sinon { reset(): void; resetHistory(): void; resetBehavior(): void; - usingPromise(promiseLibrary: any): void; + usingPromise(promiseLibrary: any): SinonSandbox; verify(): void; verifyAndRestore(): void; } diff --git a/types/sinon/sinon-tests.ts b/types/sinon/sinon-tests.ts index 41f38318dc..5304e04360 100644 --- a/types/sinon/sinon-tests.ts +++ b/types/sinon/sinon-tests.ts @@ -92,6 +92,7 @@ function testNine() { function testSandbox() { let sandbox = sinon.sandbox.create(); + sandbox = sandbox.usingPromise(Promise); sandbox.assert.notCalled(sinon.spy()); @@ -106,7 +107,6 @@ function testSandbox() { sandbox.reset(); sandbox.resetHistory(); sandbox.resetBehavior(); - sandbox.usingPromise(Promise); sandbox.verify(); sandbox.verifyAndRestore(); } @@ -130,7 +130,7 @@ function testResetHistory() { } function testUsingPromises() { - sinon.stub().usingPromise(Promise); + const stub: sinon.SinonStub = sinon.stub().usingPromise(Promise); } function testSpy() {