mirror of
https://github.com/nodejs/node.git
synced 2026-10-28 10:15:07 +08:00
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>
This commit is contained in:
1 parent
44f8b4f506
commit
ef4c115cc8
1 file changed
+6
-4
@@ -6,10 +6,12 @@ const assert = require('assert');
|
||||
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';
|
||||
Object.keys(myObj); // -> [ 'foo' ]
|
||||
Object.getOwnPropertyNames(myObj); // -> [ 'foo' ]
|
||||
Object.getOwnPropertySymbols(myObj); // -> [ Symbol(foo) ]
|
||||
assert.strictEqual(Object.getOwnPropertySymbols(myObj)[0], fooSym);
|
||||
|
||||
assert.deepStrictEqual(Object.keys(myObj), ['foo']);
|
||||
assert.deepStrictEqual(Object.getOwnPropertyNames(myObj), ['foo']);
|
||||
assert.deepStrictEqual(Object.getOwnPropertySymbols(myObj), [fooSym]);
|
||||
Reference in new issue
Block a user