Skip to content

Commit

Permalink
Check that get_own_property_names does not return Symbols
Browse files Browse the repository at this point in the history
  • Loading branch information
goto-bus-stop committed Apr 8, 2020
1 parent 07b8fdf commit df96ee4
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion test/napi/lib/objects.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ describe('JsObject', function() {
assert.equal(b.readUInt32LE(12), 66012);
});

it('reads the names of own properties', function() {
it('returns only own properties from get_own_property_names', function() {
var superObject = {
a: 1
};
Expand All @@ -153,4 +153,16 @@ describe('JsObject', function() {
Object.getOwnPropertyNames(childObject)
);
});

it('does not return Symbols from get_own_property_names', function() {
var object = {};
object['this should be a thing'] = 0;
object[Symbol('this should not be a thing')] = 1;

assert.deepEqual(
addon.get_own_property_names(object),
Object.getOwnPropertyNames(object)
);
assert.equal(addon.get_own_property_names(object).length, 1);
});
});

0 comments on commit df96ee4

Please sign in to comment.