Skip to content

Commit d4bb88e

Browse files
himself65BridgeAR
authored andcommitted
test: simplify tests code
PR-URL: #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>
1 parent f897860 commit d4bb88e

1 file changed

Lines changed: 9 additions & 20 deletions

File tree

‎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
constStreamWrapProto=Object.getPrototypeOf(TTY.prototype);
36+
constproperties=['bytesRead','fd','_externalStream'];
3637

37-
// Should not throw for Object.getOwnPropertyDescriptor
38-
assert.strictEqual(
39-
typeofObject.getOwnPropertyDescriptor(StreamWrapProto,'bytesRead'),
40-
'object'
41-
);
42-
43-
assert.strictEqual(
44-
typeofObject.getOwnPropertyDescriptor(StreamWrapProto,'fd'),
45-
'object'
46-
);
47-
48-
assert.strictEqual(
49-
typeofObject.getOwnPropertyDescriptor(StreamWrapProto,'_externalStream'),
50-
'object'
51-
);
52-
53-
assert.strictEqual(
54-
typeofObject.getOwnPropertyDescriptor(StreamWrapProto,'fd'),
55-
'object'
56-
);
38+
properties.forEach((property)=>{
39+
// Should not throw for Object.getOwnPropertyDescriptor
40+
assert.strictEqual(
41+
typeofObject.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)