diff options
author | himself65 <himself65@outlook.com> | 2019-06-05 13:29:12 +0800 |
---|---|---|
committer | ZYSzys <zyszys98@gmail.com> | 2019-06-09 11:02:22 +0800 |
commit | fefc275dcbbeedf9e8d0f6c156a142d50904d146 (patch) | |
tree | 59e7fb7116ddf7eadd928ea882d8b54466ff60f5 /test/parallel/test-accessor-properties.js | |
parent | a23c2308a768033dbbf5ed4b3e14359ba970cedc (diff) | |
download | android-node-v8-fefc275dcbbeedf9e8d0f6c156a142d50904d146.tar.gz android-node-v8-fefc275dcbbeedf9e8d0f6c156a142d50904d146.tar.bz2 android-node-v8-fefc275dcbbeedf9e8d0f6c156a142d50904d146.zip |
test: simplify tests code
PR-URL: https://github.com/nodejs/node/pull/28065
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Diffstat (limited to 'test/parallel/test-accessor-properties.js')
-rw-r--r-- | test/parallel/test-accessor-properties.js | 29 |
1 files changed, 9 insertions, 20 deletions
diff --git a/test/parallel/test-accessor-properties.js b/test/parallel/test-accessor-properties.js index 463118593f..cbd3ed65bb 100644 --- a/test/parallel/test-accessor-properties.js +++ b/test/parallel/test-accessor-properties.js @@ -33,27 +33,16 @@ const UDP = internalBinding('udp_wrap').UDP; }, TypeError); const StreamWrapProto = Object.getPrototypeOf(TTY.prototype); + const properties = ['bytesRead', 'fd', '_externalStream']; - // Should not throw for Object.getOwnPropertyDescriptor - assert.strictEqual( - typeof Object.getOwnPropertyDescriptor(StreamWrapProto, 'bytesRead'), - 'object' - ); - - assert.strictEqual( - typeof Object.getOwnPropertyDescriptor(StreamWrapProto, 'fd'), - 'object' - ); - - assert.strictEqual( - typeof Object.getOwnPropertyDescriptor(StreamWrapProto, '_externalStream'), - 'object' - ); - - assert.strictEqual( - typeof Object.getOwnPropertyDescriptor(StreamWrapProto, 'fd'), - 'object' - ); + properties.forEach((property) => { + // Should not throw for Object.getOwnPropertyDescriptor + assert.strictEqual( + typeof Object.getOwnPropertyDescriptor(StreamWrapProto, property), + 'object', + 'typeof property descriptor ' + property + ' is not \'object\'' + ); + }); if (common.hasCrypto) { // eslint-disable-line node-core/crypto-check // There are accessor properties in crypto too |