Skip to content

Commit

Permalink
Removed hasOwnProperty checks from object partial stub internals.
Browse files Browse the repository at this point in the history
  • Loading branch information
ttarnowski committed Aug 27, 2020
1 parent 071343e commit 2cd7d4f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ts-sinon",
"version": "2.0.0",
"version": "2.0.1",
"description": "sinon library extension to stub whole object and interfaces",
"author": {
"name": "Tomasz Tarnowski",
Expand Down
8 changes: 3 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export function stubObject<T extends object>(object: T, methods?: ObjectMethodsK
];

for (let method in object) {
if (object.hasOwnProperty(method) && typeof object[method] == "function") {
if (typeof object[method] == "function") {
objectMethods.push(method);
}
}
Expand All @@ -40,10 +40,8 @@ export function stubObject<T extends object>(object: T, methods?: ObjectMethodsK
}
} else if (typeof methods == "object") {
for (let method in methods) {
if (methods.hasOwnProperty(method)) {
stubObject[<string>method] = sinon.stub();
stubObject[<string>method].returns(methods[method]);
}
stubObject[<string>method] = sinon.stub();
stubObject[<string>method].returns(methods[method]);
}
} else {
for (let method of objectMethods) {
Expand Down

0 comments on commit 2cd7d4f

Please sign in to comment.