From 2f8c858a75936c517443cde45854c328a4fe8660 Mon Sep 17 00:00:00 2001 From: himself65 Date: Sun, 13 Oct 2019 12:15:31 +0800 Subject: [PATCH] test: refactor test-accessor-properties PR-URL: https://github.com/nodejs/node/pull/29943 Reviewed-By: Anna Henningsen Reviewed-By: Ruben Bridgewater --- test/parallel/test-accessor-properties.js | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/test/parallel/test-accessor-properties.js b/test/parallel/test-accessor-properties.js index cbd3ed65bb9dfb..a84889d617b4ad 100644 --- a/test/parallel/test-accessor-properties.js +++ b/test/parallel/test-accessor-properties.js @@ -16,18 +16,6 @@ const UDP = internalBinding('udp_wrap').UDP; { // Should throw instead of raise assertions - assert.throws(() => { - TTY.prototype.bytesRead; - }, TypeError); - - assert.throws(() => { - TTY.prototype.fd; - }, TypeError); - - assert.throws(() => { - TTY.prototype._externalStream; - }, TypeError); - assert.throws(() => { UDP.prototype.fd; }, TypeError); @@ -36,6 +24,11 @@ const UDP = internalBinding('udp_wrap').UDP; const properties = ['bytesRead', 'fd', '_externalStream']; properties.forEach((property) => { + // Should throw instead of raise assertions + assert.throws(() => { + TTY.prototype[property]; + }, TypeError, `Missing expected TypeError for TTY.prototype.${property}`); + // Should not throw for Object.getOwnPropertyDescriptor assert.strictEqual( typeof Object.getOwnPropertyDescriptor(StreamWrapProto, property),