Skip to content

Commit

Permalink
Fix: Avoid object prototype props being flagged as assertions in asse…
Browse files Browse the repository at this point in the history
…rt-args
  • Loading branch information
platinumazure committed Jan 19, 2016
1 parent 93074ee commit c376e06
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ exports.isAssertion = function (calleeNode, assertVar) {
calleeNode.property &&
calleeNode.property.name in ASSERTION_ARITY;
} else if (calleeNode.type === "Identifier") {
return calleeNode.name in ASSERTION_ARITY;
return Object.hasOwnProperty.call(ASSERTION_ARITY, calleeNode.name);
}

return false;
Expand Down
3 changes: 2 additions & 1 deletion tests/lib/rules/assert-args.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,10 @@ ruleTester.run("assert-args", rule, {
// not actually an assertion
wrap("notAnAssertion(result, expected);"),
wrap("getAssertion()(result, expected);"),
wrap("hasOwnProperty('prop');"),

// unwrapped
"notAnAssertion(result, expected);"
// "notAnAssertion(result, expected);"
],

invalid: [
Expand Down

0 comments on commit c376e06

Please sign in to comment.