From 426b27e929dedb71ec01cc2eff4d548815d7bbd3 Mon Sep 17 00:00:00 2001 From: Richard Towers Date: Mon, 25 Mar 2013 15:05:08 +0000 Subject: [PATCH] mock `expects` should return an `Expectation`, rather than a `ExpectationStatic`. http://sinonjs.org/docs/#mocks --- sinon/sinon-1.5.d.ts | 2 +- sinon/sinon-tests.ts | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/sinon/sinon-1.5.d.ts b/sinon/sinon-1.5.d.ts index 098aca8a0f..07c4926508 100644 --- a/sinon/sinon-1.5.d.ts +++ b/sinon/sinon-1.5.d.ts @@ -142,7 +142,7 @@ interface SinonExpectationStatic { } interface SinonMock { - expects(method: string): SinonExpectationStatic; + expects(method: string): SinonExpectation; restore(): void; verify(): void; } diff --git a/sinon/sinon-tests.ts b/sinon/sinon-tests.ts index a9db8360d5..8247e36b31 100644 --- a/sinon/sinon-tests.ts +++ b/sinon/sinon-tests.ts @@ -69,9 +69,17 @@ function testSix() { stub.restore(); } +function testSeven() { + var obj = { functionToTest : function () { } }; + var mockObj = sinon.mock(obj); + obj.functionToTest(); + mockObj.expects('functionToTest').once(); +} + testOne(); testTwo(); testThree(); testFour(); testFive(); -testSix(); \ No newline at end of file +testSix(); +testSeven(); \ No newline at end of file