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

Function testHasOwnProperty

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

Source from the content-addressed store, hash-verified

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

Callers 1

testFunction · 0.85

Calls

no outgoing calls

Tested by 1

testFunction · 0.68