diff --git a/test/proto.js b/test/proto.js index 589efd7..668da5f 100644 --- a/test/proto.js +++ b/test/proto.js @@ -5,6 +5,20 @@ var test = require('tape'); /* eslint no-proto: 0 */ +// Not pollution as such, but verify protections working as intended. +test('trailing __proto__ key in dotted option ignored', function (t) { + var argv = parse(['--a.__proto__', 'IGNORED']); + t.deepEqual(argv.a, {}); + t.end(); +}); + +// Not pollution as such, but verify protections working as intended. +test('trailing constructor key in dotted option ignored', function (t) { + var argv = parse(['--a.constructor', 'IGNORED']); + t.deepEqual(argv.a, {}); + t.end(); +}); + test('proto pollution', function (t) { var argv = parse(['--__proto__.x', '123']); t.equal({}.x, undefined);