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 authored and Franck Romano committed Oct 1, 2019
1 parent 426a7c9 commit ca4b40b
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 ca4b40b

Please sign in to comment.