From eefcc7749e4562bcb890bc5f43a72a643530d5c6 Mon Sep 17 00:00:00 2001 From: ninevra Date: Tue, 6 Apr 2021 03:00:12 -0700 Subject: [PATCH] Test with `__proto__` keys (#34) --- test.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test.js b/test.js index 67fb1ce..ee57c23 100644 --- a/test.js +++ b/test.js @@ -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}} + ); +});