node/test/js-native-api/test_symbol/test2.js
Darshan Sen ef4c115cc8
test: replace commented out expectations with tests
Signed-off-by: Darshan Sen <raisinten@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/41667
Reviewed-By: Mestery <mestery@protonmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
2022-01-29 10:01:10 +00:00

18 lines
541 B
JavaScript

'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');
assert.strictEqual(fooSym.toString(), 'Symbol(foo)');
const myObj = {};
myObj.foo = 'bar';
myObj[fooSym] = 'baz';
assert.deepStrictEqual(Object.keys(myObj), ['foo']);
assert.deepStrictEqual(Object.getOwnPropertyNames(myObj), ['foo']);
assert.deepStrictEqual(Object.getOwnPropertySymbols(myObj), [fooSym]);