Skip to content

Commit

Permalink
Test with __proto__ keys (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
ninevra authored Apr 6, 2021
1 parent 81b0ba1 commit eefcc77
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,3 +152,15 @@ test('validates input', t => {
mapObject(1, () => {});
}, TypeError);
});

test.failing('identity function preserves __proto__ keys', t => {
const input = {['__proto__']: {one: 1}};
t.deepEqual(mapObject(input, (key, value) => [key, value]), input);
});

test.failing('mapper can produce __proto__ keys', t => {
t.deepEqual(
mapObject({proto: {one: 1}}, (key, value) => [`__${key}__`, value]),
{['__proto__']: {one: 1}}
);
});

0 comments on commit eefcc77

Please sign in to comment.