Skip to content

Commit c54e423

Browse files
addaleaxtargos
authored andcommitted
test: remove unnecessary assertions
It’s not necessary to assert that the internal `hasRef()` method exists, since it is always called directly afterwards in these tests. Furthermore, the test is overly specific, in that it expects them on a specific position in the prototype chain. PR-URL: #23040 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Denys Otrishko <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]>
1 parent c34db7a commit c54e423

File tree

2 files changed

+0
-12
lines changed

2 files changed

+0
-12
lines changed

test/parallel/test-handle-wrap-isrefed.js

-10
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ const strictEqual = require('assert').strictEqual;
99
const spawn = require('child_process').spawn;
1010
const cmd = common.isWindows ? 'rundll32' : 'ls';
1111
const cp = spawn(cmd);
12-
strictEqual(Object.getPrototypeOf(cp._handle).hasOwnProperty('hasRef'),
13-
true, 'process_wrap: hasRef() missing');
1412
strictEqual(cp._handle.hasRef(),
1513
true, 'process_wrap: not initially refed');
1614
cp.unref();
@@ -33,8 +31,6 @@ const { kStateSymbol } = require('internal/dgram');
3331
const sock4 = dgram.createSocket('udp4');
3432
const handle = sock4[kStateSymbol].handle;
3533

36-
strictEqual(Object.getPrototypeOf(handle).hasOwnProperty('hasRef'),
37-
true, 'udp_wrap: ipv4: hasRef() missing');
3834
strictEqual(handle.hasRef(),
3935
true, 'udp_wrap: ipv4: not initially refed');
4036
sock4.unref();
@@ -54,8 +50,6 @@ const { kStateSymbol } = require('internal/dgram');
5450
const sock6 = dgram.createSocket('udp6');
5551
const handle = sock6[kStateSymbol].handle;
5652

57-
strictEqual(Object.getPrototypeOf(handle).hasOwnProperty('hasRef'),
58-
true, 'udp_wrap: ipv6: hasRef() missing');
5953
strictEqual(handle.hasRef(),
6054
true, 'udp_wrap: ipv6: not initially refed');
6155
sock6.unref();
@@ -74,8 +68,6 @@ const { kStateSymbol } = require('internal/dgram');
7468
{
7569
const { Pipe, constants: PipeConstants } = process.binding('pipe_wrap');
7670
const handle = new Pipe(PipeConstants.SOCKET);
77-
strictEqual(Object.getPrototypeOf(handle).hasOwnProperty('hasRef'),
78-
true, 'pipe_wrap: hasRef() missing');
7971
strictEqual(handle.hasRef(),
8072
true, 'pipe_wrap: not initially refed');
8173
handle.unref();
@@ -94,8 +86,6 @@ const { kStateSymbol } = require('internal/dgram');
9486
{
9587
const net = require('net');
9688
const server = net.createServer(() => {}).listen(0);
97-
strictEqual(Object.getPrototypeOf(server._handle).hasOwnProperty('hasRef'),
98-
true, 'tcp_wrap: hasRef() missing');
9989
strictEqual(server._handle.hasRef(),
10090
true, 'tcp_wrap: not initially refed');
10191
strictEqual(server._unref,

test/pseudo-tty/test-handle-wrap-isrefed-tty.js

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ const ReadStream = require('tty').ReadStream;
88
const tty = new ReadStream(0);
99
const isTTY = process.binding('tty_wrap').isTTY;
1010
strictEqual(isTTY(0), true, 'tty_wrap: stdin is not a TTY');
11-
strictEqual(Object.getPrototypeOf(tty._handle).hasOwnProperty('hasRef'),
12-
true, 'tty_wrap: hasRef() missing');
1311
strictEqual(tty._handle.hasRef(),
1412
true, 'tty_wrap: not initially refed');
1513
tty.unref();

0 commit comments

Comments
 (0)