Skip to content

Commit

Permalink
Add test case for polluted property to hasOwn suite
Browse files Browse the repository at this point in the history
  • Loading branch information
ericcornelissen committed Nov 19, 2023
1 parent 14ad5fc commit 781c6b2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/executables.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ export function resolveExecutable(
const path = hasOwn(env, "PATH")
? env.PATH
: hasOwn(env, "Path")
? env.Path
: undefined;
? env.Path
: undefined;
resolved = which(resolved, { path });
} catch (_) {
throw new Error(notFoundError(executable));
Expand Down
12 changes: 12 additions & 0 deletions test/unit/reflection/has-own.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,15 @@ testProp(
t.is(actual, expected);
},
);

testProp(
"polluted",
[fc.object(), fc.string(), fc.string()],
(t, object, property, value) => {
object = Object.assign(Object.create({ [property]: value }), object);

const actual = hasOwn(object, property);
const expected = Object.hasOwn(object, property);
t.is(actual, expected);
},
);

0 comments on commit 781c6b2

Please sign in to comment.