From 2f7adbeb8ece3a68a5b63cb0c6b3fbb374ea7fd5 Mon Sep 17 00:00:00 2001 From: Jonathan Little Date: Fri, 31 Mar 2017 16:24:20 -0700 Subject: [PATCH] Added assert, verify, and verifyAndRestore for SinonJS sandbox. --- types/sinon/index.d.ts | 3 +++ types/sinon/sinon-tests.ts | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/types/sinon/index.d.ts b/types/sinon/index.d.ts index 224ab4003f..4a02ec691a 100644 --- a/types/sinon/index.d.ts +++ b/types/sinon/index.d.ts @@ -394,6 +394,7 @@ declare namespace Sinon { } interface SinonSandbox { + assert: SinonAssert; clock: SinonFakeTimers; requests: SinonFakeXMLHttpRequest; server: SinonFakeServer; @@ -407,6 +408,8 @@ declare namespace Sinon { reset(): void; resetHistory(): void; resetBehavior(): void; + verify(): void; + verifyAndRestore(): void; } interface SinonSandboxStatic { diff --git a/types/sinon/sinon-tests.ts b/types/sinon/sinon-tests.ts index 8354045a25..2637d92c33 100644 --- a/types/sinon/sinon-tests.ts +++ b/types/sinon/sinon-tests.ts @@ -90,6 +90,9 @@ function testNine() { function testSandbox() { var sandbox = sinon.sandbox.create(); + + sandbox.assert.notCalled(sinon.spy()); + if (sandbox.spy().called) { sandbox.stub(objectUnderTest, "process").yieldsTo("success"); sandbox.mock(objectUnderTest).expects("process").once(); @@ -101,6 +104,8 @@ function testSandbox() { sandbox.reset(); sandbox.resetHistory(); sandbox.resetBehavior(); + sandbox.verify(); + sandbox.verifyAndRestore(); } function testPromises() {