summaryrefslogtreecommitdiff
path: root/test/js-native-api/test_symbol/test2.js
blob: 2060409b9bf8dfcb8caef7100dced809cd6abf78 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
'use strict';
const common = require('../../common');
const assert = require('assert');

// Testing api calls for symbol
const test_symbol = require(`./build/${common.buildType}/test_symbol`);

const fooSym = test_symbol.New('foo');
const myObj = {};
myObj.foo = 'bar';
myObj[fooSym] = 'baz';
Object.keys(myObj); // -> [ 'foo' ]
Object.getOwnPropertyNames(myObj); // -> [ 'foo' ]
Object.getOwnPropertySymbols(myObj); // -> [ Symbol(foo) ]
assert.strictEqual(Object.getOwnPropertySymbols(myObj)[0], fooSym);