Skip to content

Commit

Permalink
test: simplify tests code
Browse files Browse the repository at this point in the history
PR-URL: nodejs#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>
himself65 authored and ZYSzys committed Jun 9, 2019

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent a23c230 commit fefc275
Showing 1 changed file with 9 additions and 20 deletions.
29 changes: 9 additions & 20 deletions test/parallel/test-accessor-properties.js
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit fefc275

Please sign in to comment.