mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
b0d31bb854
Document describes that the value have to be 10 if passed value to `setDefaultAutoSelectFamilyAttemptTimeout` is less than 10. So need to use 10 for 'if' statement and fix typo in document. Refs: https://github.com/nodejs/node/blob/main/doc/api/net.md#netsetdefaultautoselectfamilyattempttimeoutvalue PR-URL: https://github.com/nodejs/node/pull/47012 Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
28 lines
790 B
JavaScript
28 lines
790 B
JavaScript
'use strict';
|
|
|
|
require('../common');
|
|
|
|
const assert = require('assert');
|
|
const net = require('net');
|
|
|
|
for (const autoSelectFamilyAttemptTimeout of [-10, 0]) {
|
|
assert.throws(() => {
|
|
net.connect({
|
|
port: 8080,
|
|
autoSelectFamily: true,
|
|
autoSelectFamilyAttemptTimeout,
|
|
});
|
|
}, { code: 'ERR_OUT_OF_RANGE' });
|
|
|
|
assert.throws(() => {
|
|
net.setDefaultAutoSelectFamilyAttemptTimeout(autoSelectFamilyAttemptTimeout);
|
|
}, { code: 'ERR_OUT_OF_RANGE' });
|
|
}
|
|
|
|
// Check the default value of autoSelectFamilyAttemptTimeout is 10
|
|
// if passed number is less than 10
|
|
for (const autoSelectFamilyAttemptTimeout of [1, 9]) {
|
|
net.setDefaultAutoSelectFamilyAttemptTimeout(autoSelectFamilyAttemptTimeout);
|
|
assert.strictEqual(net.getDefaultAutoSelectFamilyAttemptTimeout(), 10);
|
|
}
|