From c54e42362c96a850c064d0c98189224b33476e2b Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Sun, 23 Sep 2018 19:28:27 +0200 Subject: [PATCH] test: remove unnecessary assertions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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: https://github.com/nodejs/node/pull/23040 Reviewed-By: Michaël Zasso Reviewed-By: Tobias Nießen Reviewed-By: Denys Otrishko Reviewed-By: Luigi Pinca Reviewed-By: Ruben Bridgewater Reviewed-By: James M Snell Reviewed-By: Colin Ihrig Reviewed-By: Trivikram Kamat Reviewed-By: Sakthipriyan Vairamani --- test/parallel/test-handle-wrap-isrefed.js | 10 ---------- test/pseudo-tty/test-handle-wrap-isrefed-tty.js | 2 -- 2 files changed, 12 deletions(-) diff --git a/test/parallel/test-handle-wrap-isrefed.js b/test/parallel/test-handle-wrap-isrefed.js index aea5514df96eed..a7257e50d98c96 100644 --- a/test/parallel/test-handle-wrap-isrefed.js +++ b/test/parallel/test-handle-wrap-isrefed.js @@ -9,8 +9,6 @@ const strictEqual = require('assert').strictEqual; const spawn = require('child_process').spawn; const cmd = common.isWindows ? 'rundll32' : 'ls'; const cp = spawn(cmd); - strictEqual(Object.getPrototypeOf(cp._handle).hasOwnProperty('hasRef'), - true, 'process_wrap: hasRef() missing'); strictEqual(cp._handle.hasRef(), true, 'process_wrap: not initially refed'); cp.unref(); @@ -33,8 +31,6 @@ const { kStateSymbol } = require('internal/dgram'); const sock4 = dgram.createSocket('udp4'); const handle = sock4[kStateSymbol].handle; - strictEqual(Object.getPrototypeOf(handle).hasOwnProperty('hasRef'), - true, 'udp_wrap: ipv4: hasRef() missing'); strictEqual(handle.hasRef(), true, 'udp_wrap: ipv4: not initially refed'); sock4.unref(); @@ -54,8 +50,6 @@ const { kStateSymbol } = require('internal/dgram'); const sock6 = dgram.createSocket('udp6'); const handle = sock6[kStateSymbol].handle; - strictEqual(Object.getPrototypeOf(handle).hasOwnProperty('hasRef'), - true, 'udp_wrap: ipv6: hasRef() missing'); strictEqual(handle.hasRef(), true, 'udp_wrap: ipv6: not initially refed'); sock6.unref(); @@ -74,8 +68,6 @@ const { kStateSymbol } = require('internal/dgram'); { const { Pipe, constants: PipeConstants } = process.binding('pipe_wrap'); const handle = new Pipe(PipeConstants.SOCKET); - strictEqual(Object.getPrototypeOf(handle).hasOwnProperty('hasRef'), - true, 'pipe_wrap: hasRef() missing'); strictEqual(handle.hasRef(), true, 'pipe_wrap: not initially refed'); handle.unref(); @@ -94,8 +86,6 @@ const { kStateSymbol } = require('internal/dgram'); { const net = require('net'); const server = net.createServer(() => {}).listen(0); - strictEqual(Object.getPrototypeOf(server._handle).hasOwnProperty('hasRef'), - true, 'tcp_wrap: hasRef() missing'); strictEqual(server._handle.hasRef(), true, 'tcp_wrap: not initially refed'); strictEqual(server._unref, diff --git a/test/pseudo-tty/test-handle-wrap-isrefed-tty.js b/test/pseudo-tty/test-handle-wrap-isrefed-tty.js index 33b59b3f1a335e..f7947fc31bc3a2 100644 --- a/test/pseudo-tty/test-handle-wrap-isrefed-tty.js +++ b/test/pseudo-tty/test-handle-wrap-isrefed-tty.js @@ -8,8 +8,6 @@ const ReadStream = require('tty').ReadStream; const tty = new ReadStream(0); const isTTY = process.binding('tty_wrap').isTTY; strictEqual(isTTY(0), true, 'tty_wrap: stdin is not a TTY'); -strictEqual(Object.getPrototypeOf(tty._handle).hasOwnProperty('hasRef'), - true, 'tty_wrap: hasRef() missing'); strictEqual(tty._handle.hasRef(), true, 'tty_wrap: not initially refed'); tty.unref();