Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 6db760c

Browse filesBrowse files
Trotttargos
authored andcommitted
test: improve test-net-socket-timeout
* Check for custom Node.js code rather than constructor in assert.throws(). * Use arrow functions consistently. PR-URL: #24859 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
1 parent 643ca14 commit 6db760c
Copy full SHA for 6db760c

File tree

Expand file treeCollapse file tree

1 file changed

+7
-7
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+7
-7
lines changed
Open diff view settings
Collapse file

‎test/parallel/test-net-socket-timeout.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-net-socket-timeout.js
+7-7Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,25 +34,25 @@ const validDelays = [0, 0.001, 1, 1e6];
3434

3535

3636
for (let i = 0; i < nonNumericDelays.length; i++) {
37-
assert.throws(function() {
37+
assert.throws(() => {
3838
s.setTimeout(nonNumericDelays[i], () => {});
39-
}, TypeError, nonNumericDelays[i]);
39+
}, { code: 'ERR_INVALID_ARG_TYPE' }, nonNumericDelays[i]);
4040
}
4141

4242
for (let i = 0; i < badRangeDelays.length; i++) {
43-
assert.throws(function() {
43+
assert.throws(() => {
4444
s.setTimeout(badRangeDelays[i], () => {});
45-
}, RangeError, badRangeDelays[i]);
45+
}, { code: 'ERR_OUT_OF_RANGE' }, badRangeDelays[i]);
4646
}
4747

4848
for (let i = 0; i < validDelays.length; i++) {
4949
s.setTimeout(validDelays[i], () => {});
5050
}
5151

5252
const server = net.Server();
53-
server.listen(0, common.mustCall(function() {
54-
const socket = net.createConnection(this.address().port);
55-
socket.setTimeout(1, common.mustCall(function() {
53+
server.listen(0, common.mustCall(() => {
54+
const socket = net.createConnection(server.address().port);
55+
socket.setTimeout(1, common.mustCall(() => {
5656
socket.destroy();
5757
server.close();
5858
}));

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.