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

Function testDefineProperties

test/object/object_deprecated.js:18–37  ·  view source on GitHub ↗
(nameType)

Source from the content-addressed store, hash-verified

16 }
17
18 function testDefineProperties (nameType) {
19 const obj = {};
20 binding.object.defineProperties(obj, nameType);
21
22 assertPropertyIsNot(obj, 'readonlyAccessor', 'enumerable');
23 assertPropertyIsNot(obj, 'readonlyAccessor', 'configurable');
24 assert.strictEqual(obj.readonlyAccessor, true);
25
26 assertPropertyIsNot(obj, 'readwriteAccessor', 'enumerable');
27 assertPropertyIsNot(obj, 'readwriteAccessor', 'configurable');
28 obj.readwriteAccessor = false;
29 assert.strictEqual(obj.readwriteAccessor, false);
30 obj.readwriteAccessor = true;
31 assert.strictEqual(obj.readwriteAccessor, true);
32
33 assertPropertyIsNot(obj, 'function', 'writable');
34 assertPropertyIsNot(obj, 'function', 'enumerable');
35 assertPropertyIsNot(obj, 'function', 'configurable');
36 assert.strictEqual(obj.function(), true);
37 }
38
39 testDefineProperties('literal');
40 testDefineProperties('string');

Callers 1

testFunction · 0.70

Calls 1

assertPropertyIsNotFunction · 0.70

Tested by 1

testFunction · 0.56