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

Function testShouldThrowErrorIfKeyIsInvalid

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

Source from the content-addressed store, hash-verified

17 }
18
19 function testShouldThrowErrorIfKeyIsInvalid (nativeHasProperty) {
20 assert.throws(() => {
21 nativeHasProperty(undefined, 'test');
22 }, /Cannot convert undefined or null to object/);
23 }
24
25 const objectWithInt32Key = { 12: 101 };
26 assert.strictEqual(binding.object.hasPropertyWithUint32(objectWithInt32Key, 12), true);

Callers 1

testFunction · 0.70

Calls

no outgoing calls

Tested by 1

testFunction · 0.56