Skip to content

Commit d4bb88e

Browse files
himself65BridgeAR
authored andcommitted
test: simplify tests code
PR-URL: #28065 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Yongsheng Zhang <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: Rich Trott <[email protected]>
1 parent f897860 commit d4bb88e

File tree

1 file changed

+9
-20
lines changed

1 file changed

+9
-20
lines changed

test/parallel/test-accessor-properties.js

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -33,27 +33,16 @@ const UDP = internalBinding('udp_wrap').UDP;
3333
}, TypeError);
3434

3535
const StreamWrapProto = Object.getPrototypeOf(TTY.prototype);
36+
const properties = ['bytesRead', 'fd', '_externalStream'];
3637

37-
// Should not throw for Object.getOwnPropertyDescriptor
38-
assert.strictEqual(
39-
typeof Object.getOwnPropertyDescriptor(StreamWrapProto, 'bytesRead'),
40-
'object'
41-
);
42-
43-
assert.strictEqual(
44-
typeof Object.getOwnPropertyDescriptor(StreamWrapProto, 'fd'),
45-
'object'
46-
);
47-
48-
assert.strictEqual(
49-
typeof Object.getOwnPropertyDescriptor(StreamWrapProto, '_externalStream'),
50-
'object'
51-
);
52-
53-
assert.strictEqual(
54-
typeof Object.getOwnPropertyDescriptor(StreamWrapProto, 'fd'),
55-
'object'
56-
);
38+
properties.forEach((property) => {
39+
// Should not throw for Object.getOwnPropertyDescriptor
40+
assert.strictEqual(
41+
typeof Object.getOwnPropertyDescriptor(StreamWrapProto, property),
42+
'object',
43+
'typeof property descriptor ' + property + ' is not \'object\''
44+
);
45+
});
5746

5847
if (common.hasCrypto) { // eslint-disable-line node-core/crypto-check
5948
// There are accessor properties in crypto too

0 commit comments

Comments
 (0)