From af302133e6fd68f16e3de35b6051838e11ccf24b Mon Sep 17 00:00:00 2001 From: Alexey Kucherenko Date: Mon, 4 Sep 2017 01:07:43 +0300 Subject: [PATCH] fix #1442 --- lib/sinon/mock.js | 1 + test/issues/issues-test.js | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/lib/sinon/mock.js b/lib/sinon/mock.js index 54084d8d0..5c27d17a2 100644 --- a/lib/sinon/mock.js +++ b/lib/sinon/mock.js @@ -71,6 +71,7 @@ extend(mock, { } var expectation = mockExpectation.create(method); + extend(expectation, this.object[method]); push.call(this.expectations[method], expectation); return expectation; diff --git a/test/issues/issues-test.js b/test/issues/issues-test.js index 54d3473ca..0e1f53049 100644 --- a/test/issues/issues-test.js +++ b/test/issues/issues-test.js @@ -375,4 +375,19 @@ describe("issues", function () { }); }); }); + + describe("#1442 - callThrough with a mock expectation", function () { + it("should call original method", function () { + var foo = { + bar: function () { } + }; + + var mock = this.sandbox.mock(foo); + mock.expects("bar").callThrough(); + + foo.bar(); + + mock.verify(); + }); + }); });