MCPcopy Create free account
hub / github.com/nodejs/node-addon-api / testEnumerables

Function testEnumerables

test/objectwrap.js:112–135  ·  view source on GitHub ↗
(obj, clazz)

Source from the content-addressed store, hash-verified

110 };
111
112 const testEnumerables = (obj, clazz) => {
113 // Object.keys: only object without prototype
114 assert(Object.keys(obj).length === 2);
115 assert(Object.keys(obj).includes('ownProperty'));
116 assert(Object.keys(obj).indexOf('ownPropertyT') >= 0);
117
118 // for..in: object and prototype
119 {
120 const keys = [];
121 for (const key in obj) {
122 keys.push(key);
123 }
124
125 assert(keys.length === 6);
126 // on prototype
127 assert(keys.includes('testGetSet'));
128 assert(keys.includes('testGetter'));
129 assert(keys.includes('testValue'));
130 assert(keys.includes('testMethod'));
131 // on object only
132 assert(keys.includes('ownProperty'));
133 assert(keys.includes('ownPropertyT'));
134 }
135 };
136
137 const testConventions = (obj, clazz) => {
138 // test @@toStringTag

Callers 1

testObjFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected