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

Function testHasProperty

test/object/has_property.js:8–17  ·  view source on GitHub ↗
(nativeHasProperty)

Source from the content-addressed store, hash-verified

6
7function test (binding) {
8 function testHasProperty (nativeHasProperty) {
9 const obj = { one: 1 };
10
11 Object.defineProperty(obj, 'two', { value: 2 });
12
13 assert.strictEqual(nativeHasProperty(obj, 'one'), true);
14 assert.strictEqual(nativeHasProperty(obj, 'two'), true);
15 assert.strictEqual('toString' in obj, true);
16 assert.strictEqual(nativeHasProperty(obj, 'toString'), true);
17 }
18
19 function testShouldThrowErrorIfKeyIsInvalid (nativeHasProperty) {
20 assert.throws(() => {

Callers 1

testFunction · 0.85

Calls

no outgoing calls

Tested by 1

testFunction · 0.68