From ba0690aad3db0860bdea2ee4af7c64e3065d4e23 Mon Sep 17 00:00:00 2001 From: MrBigDog2U Date: Mon, 8 Oct 2018 10:09:14 -0700 Subject: [PATCH] Add resolves this to sinon stub (#29487) * Add support for resolvesThis() to the SinonStub definition * Whitespace complaints with lint --- types/sinon/index.d.ts | 4 ++++ types/sinon/sinon-tests.ts | 1 + 2 files changed, 5 insertions(+) diff --git a/types/sinon/index.d.ts b/types/sinon/index.d.ts index e110e72617..8cf995b5a9 100644 --- a/types/sinon/index.d.ts +++ b/types/sinon/index.d.ts @@ -404,6 +404,10 @@ declare namespace Sinon { * If the argument at the provided index is not available, a TypeError will be thrown. */ resolvesArg(index: number): SinonStub; + /** + * Causes the stub to return a Promise which resolves to its this value. + */ + resolvesThis(): SinonStub; /** * Causes the stub to throw an exception (Error). * @param type diff --git a/types/sinon/sinon-tests.ts b/types/sinon/sinon-tests.ts index 502e3f5fd2..8ae53c7d8e 100644 --- a/types/sinon/sinon-tests.ts +++ b/types/sinon/sinon-tests.ts @@ -404,6 +404,7 @@ function testStub() { stub.resolves(); stub.resolves('foo'); stub.resolvesArg(1); + stub.resolvesThis(); stub.throws(); stub.throws('err'); stub.throws(new Error('err'));