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>
This commit is contained in:
himself65 2019-06-05 13:29:12 +08:00 committed by ZYSzys
parent a23c2308a7
commit fefc275dcb

View File

@ -33,27 +33,16 @@ const UDP = internalBinding('udp_wrap').UDP;
}, TypeError); }, TypeError);
const StreamWrapProto = Object.getPrototypeOf(TTY.prototype); const StreamWrapProto = Object.getPrototypeOf(TTY.prototype);
const properties = ['bytesRead', 'fd', '_externalStream'];
// Should not throw for Object.getOwnPropertyDescriptor properties.forEach((property) => {
assert.strictEqual( // Should not throw for Object.getOwnPropertyDescriptor
typeof Object.getOwnPropertyDescriptor(StreamWrapProto, 'bytesRead'), assert.strictEqual(
'object' typeof Object.getOwnPropertyDescriptor(StreamWrapProto, property),
); 'object',
'typeof property descriptor ' + property + ' is not \'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'
);
if (common.hasCrypto) { // eslint-disable-line node-core/crypto-check if (common.hasCrypto) { // eslint-disable-line node-core/crypto-check
// There are accessor properties in crypto too // There are accessor properties in crypto too