Skip to content

Commit

Permalink
Adding a test for the case where an object has Implemented hasOwnProp…
Browse files Browse the repository at this point in the history
…erty
  • Loading branch information
launchcg-ztonia committed Sep 7, 2016
1 parent efe737b commit 50e4709
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions test/mock-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -906,6 +906,31 @@
}
},

"mock object with hasOwnProperty": {
setUp: function () {
this.method = function () {};
this.hasOwn = function () {
throw Error("overridden method hasOwnProperty invoked");
};
this.object = { method: this.method, hasOwnProperty: this.hasOwn };
this.mock = sinon.mock.create(this.object);
},

"mocks object method": function () {
this.mock.expects("method");

assert.isFunction(this.object.method);
refute.same(this.object.method, this.method);
},

"reverts mocked method": function () {
this.mock.expects("method");
this.object.method.restore();

assert.same(this.object.method, this.method);
}
},

"mock method multiple times": {
setUp: function () {
this.thisValue = {};
Expand Down

0 comments on commit 50e4709

Please sign in to comment.