From 275970973e0d52b173e54ca654b01cb4c199fb82 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sun, 24 Dec 2017 23:09:05 -0800 Subject: [PATCH] test: replace map() with forEach() where appropriate Two tests were using Array.prototype.map() without returning values in the callback. In other words, they were using it where a `.forEach()` was called for. Change to `.forEach()`. PR-URL: https://github.com/nodejs/node/pull/17858 Reviewed-By: Weijia Wang Reviewed-By: Tiancheng "Timothy" Gu Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: Khaidi Chu Reviewed-By: James M Snell Reviewed-By: Ruben Bridgewater --- test/parallel/test-https-options-boolean-check.js | 8 ++++---- test/parallel/test-tls-options-boolean-check.js | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/test/parallel/test-https-options-boolean-check.js b/test/parallel/test-https-options-boolean-check.js index ed124d43fbb74f..04baf403df98cb 100644 --- a/test/parallel/test-https-options-boolean-check.js +++ b/test/parallel/test-https-options-boolean-check.js @@ -64,7 +64,7 @@ const invalidCertRE = /^The "cert" argument must be one of type string, Buffer, [false, [certStr, certStr2]], [[{ pem: keyBuff }], false], [[{ pem: keyBuff }, { pem: keyBuff }], false] -].map((params) => { +].forEach((params) => { assert.doesNotThrow(() => { https.createServer({ key: params[0], @@ -100,7 +100,7 @@ const invalidCertRE = /^The "cert" argument must be one of type string, Buffer, [[keyStr, keyStr2], [true, false], invalidCertRE], [[keyStr, keyStr2], true, invalidCertRE], [true, [certBuff, certBuff2], invalidKeyRE] -].map((params) => { +].forEach((params) => { common.expectsError(() => { https.createServer({ key: params[0], @@ -123,7 +123,7 @@ const invalidCertRE = /^The "cert" argument must be one of type string, Buffer, [keyBuff, certBuff, caArrBuff], [keyBuff, certBuff, caArrDataView], [keyBuff, certBuff, false], -].map((params) => { +].forEach((params) => { assert.doesNotThrow(() => { https.createServer({ key: params[0], @@ -141,7 +141,7 @@ const invalidCertRE = /^The "cert" argument must be one of type string, Buffer, [keyBuff, certBuff, 1], [keyBuff, certBuff, true], [keyBuff, certBuff, [caCert, true]] -].map((params) => { +].forEach((params) => { common.expectsError(() => { https.createServer({ key: params[0], diff --git a/test/parallel/test-tls-options-boolean-check.js b/test/parallel/test-tls-options-boolean-check.js index d77f66c6885c97..b84d9b8b1732c4 100644 --- a/test/parallel/test-tls-options-boolean-check.js +++ b/test/parallel/test-tls-options-boolean-check.js @@ -64,7 +64,7 @@ const invalidCertRE = /^The "cert" argument must be one of type string, Buffer, [false, [certStr, certStr2]], [[{ pem: keyBuff }], false], [[{ pem: keyBuff }, { pem: keyBuff }], false] -].map(([key, cert]) => { +].forEach(([key, cert]) => { assert.doesNotThrow(() => { tls.createServer({ key, cert }); }); @@ -97,7 +97,7 @@ const invalidCertRE = /^The "cert" argument must be one of type string, Buffer, [[keyStr, keyStr2], [true, false], invalidCertRE], [[keyStr, keyStr2], true, invalidCertRE], [true, [certBuff, certBuff2], invalidKeyRE] -].map(([key, cert, message]) => { +].forEach(([key, cert, message]) => { common.expectsError(() => { tls.createServer({ key, cert }); }, { @@ -117,7 +117,7 @@ const invalidCertRE = /^The "cert" argument must be one of type string, Buffer, [keyBuff, certBuff, caArrBuff], [keyBuff, certBuff, caArrDataView], [keyBuff, certBuff, false], -].map(([key, cert, ca]) => { +].forEach(([key, cert, ca]) => { assert.doesNotThrow(() => { tls.createServer({ key, cert, ca }); }); @@ -131,7 +131,7 @@ const invalidCertRE = /^The "cert" argument must be one of type string, Buffer, [keyBuff, certBuff, 1], [keyBuff, certBuff, true], [keyBuff, certBuff, [caCert, true]] -].map(([key, cert, ca]) => { +].forEach(([key, cert, ca]) => { common.expectsError(() => { tls.createServer({ key, cert, ca }); }, { @@ -149,7 +149,7 @@ const invalidCertRE = /^The "cert" argument must be one of type string, Buffer, [keyBuff, certBuff, 1], [keyBuff, certBuff, true], [keyBuff, certBuff, [caCert, true]] -].map(([key, cert, ca]) => { +].forEach(([key, cert, ca]) => { common.expectsError(() => { tls.createServer({ key, cert, ca }); }, { @@ -167,7 +167,7 @@ const invalidCertRE = /^The "cert" argument must be one of type string, Buffer, [undefined, undefined, undefined], ['', '', ''], [0, 0, 0] -].map(([key, cert, ca]) => { +].forEach(([key, cert, ca]) => { assert.doesNotThrow(() => { tls.createSecureContext({ key, cert, ca }); });