Skip to content

Commit

Permalink
Add regression test for sinonjs#1850
Browse files Browse the repository at this point in the history
  • Loading branch information
fatso83 committed Sep 17, 2018
1 parent 6377e5b commit c7b676a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test/fake-test.js
Expand Up @@ -51,6 +51,17 @@ describe("fake", function () {

describe("when passed a Function", function () {
verifyProxy(fake, function () {});

it("should keep the `this` context of the wrapped function", function () {
function method() { return this.foo; }
var o = { foo: 42 };
var fakeMethod = fake(method);

var result = fakeMethod.call(o);

assert.equals(fakeMethod.callCount, 1);
assert.equals(result, 42);
});
});

describe("when passed no value", function () {
Expand Down

0 comments on commit c7b676a

Please sign in to comment.