summaryrefslogtreecommitdiff
path: root/test/parallel/test-tls-options-boolean-check.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/parallel/test-tls-options-boolean-check.js')
-rw-r--r--test/parallel/test-tls-options-boolean-check.js25
1 files changed, 14 insertions, 11 deletions
diff --git a/test/parallel/test-tls-options-boolean-check.js b/test/parallel/test-tls-options-boolean-check.js
index 242df1140e..4caf621559 100644
--- a/test/parallel/test-tls-options-boolean-check.js
+++ b/test/parallel/test-tls-options-boolean-check.js
@@ -74,20 +74,21 @@ const caArrDataView = toDataView(caCert);
[true, certDataView],
[true, false],
[true, false],
- [{ pem: keyBuff }, false, 'pem'],
+ [{ pem: keyBuff }, false],
[[keyBuff, true], [certBuff, certBuff2], 1],
[[true, keyStr2], [certStr, certStr2], 0],
[[true, false], [certBuff, certBuff2], 0],
[true, [certBuff, certBuff2]]
].forEach(([key, cert, index]) => {
- const type = typeof (index === undefined ? key : key[index]);
+ const val = index === undefined ? key : key[index];
common.expectsError(() => {
tls.createServer({ key, cert });
}, {
code: 'ERR_INVALID_ARG_TYPE',
type: TypeError,
- message: 'The "options.key" property must be one of type string, Buffer, ' +
- `TypedArray, or DataView. Received type ${type}`
+ message: 'The "options.key" property must be of type string or an ' +
+ 'instance of Buffer, TypedArray, or DataView.' +
+ common.invalidArgTypeHelper(val)
});
});
@@ -98,21 +99,22 @@ const caArrDataView = toDataView(caCert);
[keyDataView, true],
[true, true],
[false, true],
- [false, { pem: keyBuff }, 'pem'],
+ [false, { pem: keyBuff }],
[false, 1],
[[keyBuff, keyBuff2], [true, certBuff2], 0],
[[keyStr, keyStr2], [certStr, true], 1],
[[keyStr, keyStr2], [true, false], 0],
[[keyStr, keyStr2], true]
].forEach(([key, cert, index]) => {
- const type = typeof (index === undefined ? cert : cert[index]);
+ const val = index === undefined ? cert : cert[index];
common.expectsError(() => {
tls.createServer({ key, cert });
}, {
code: 'ERR_INVALID_ARG_TYPE',
type: TypeError,
- message: 'The "options.cert" property must be one of type string, Buffer,' +
- ` TypedArray, or DataView. Received type ${type}`
+ message: 'The "options.cert" property must be of type string or an ' +
+ 'instance of Buffer, TypedArray, or DataView.' +
+ common.invalidArgTypeHelper(val)
});
});
@@ -139,14 +141,15 @@ const caArrDataView = toDataView(caCert);
[keyBuff, certBuff, true],
[keyBuff, certBuff, [caCert, true], 1]
].forEach(([key, cert, ca, index]) => {
- const type = typeof (index === undefined ? ca : ca[index]);
+ const val = index === undefined ? ca : ca[index];
common.expectsError(() => {
tls.createServer({ key, cert, ca });
}, {
code: 'ERR_INVALID_ARG_TYPE',
type: TypeError,
- message: 'The "options.ca" property must be one of type string, Buffer, ' +
- `TypedArray, or DataView. Received type ${type}`
+ message: 'The "options.ca" property must be of type string or an instance' +
+ ' of Buffer, TypedArray, or DataView.' +
+ common.invalidArgTypeHelper(val)
});
});