From 4a6ac52b15f7431e01f6f92a9b03dc2fe36e3b8a Mon Sep 17 00:00:00 2001 From: dacoozheng <23788425@qq.com> Date: Sun, 3 Jan 2016 19:18:43 +0800 Subject: Test case for #998. --- test/test-async.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/test/test-async.js b/test/test-async.js index 05c0228..19c30c1 100755 --- a/test/test-async.js +++ b/test/test-async.js @@ -4309,6 +4309,32 @@ exports['memoize'] = { test.equal(val, "bar"); test.done(); }); +}, + + 'avoid constructor key return undefined': function (test) { + test.expect(1); + var fn = async.memoize(function(name, callback) { + async.setImmediate(function(){ + callback(null, name); + }); + }); + fn('constructor', function(error, results) { + test.equal(results, 'constructor'); + test.done(); + }); +}, + + 'avoid __proto__ key return undefined': function (test) { + test.expect(1); + var fn = async.memoize(function(name, callback) { + async.setImmediate(function(){ + callback(null, name); + }); + }); + fn('__proto__', function(error, results) { + test.equal(results, '__proto__'); + test.done(); + }); } }; -- cgit v1.2.1