Skip to content

Commit

Permalink
test: replace map() with forEach() where appropriate
Browse files Browse the repository at this point in the history
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: #17858
Reviewed-By: Weijia Wang <[email protected]>
Reviewed-By: Tiancheng "Timothy" Gu <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Khaidi Chu <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
  • Loading branch information
Trott authored and MylesBorins committed Jan 9, 2018
1 parent b1bc768 commit 2759709
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions test/parallel/test-https-options-boolean-check.js
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down Expand Up @@ -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],
Expand All @@ -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],
Expand All @@ -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],
Expand Down
12 changes: 6 additions & 6 deletions test/parallel/test-tls-options-boolean-check.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
});
Expand Down Expand Up @@ -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 });
}, {
Expand All @@ -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 });
});
Expand All @@ -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 });
}, {
Expand All @@ -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 });
}, {
Expand All @@ -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 });
});
Expand Down

0 comments on commit 2759709

Please sign in to comment.