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 <starkwang@126.com>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Khaidi Chu <i@2333.moe>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
This commit is contained in:
Rich Trott 2017-12-24 23:09:05 -08:00 committed by James M Snell
parent 5c7af90cbf
commit fe8a5aa0b2
2 changed files with 10 additions and 10 deletions

View File

@ -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],

View File

@ -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 });
});