Skip to content

Commit

Permalink
test: replace commented out expectations with tests
Browse files Browse the repository at this point in the history
Signed-off-by: Darshan Sen <[email protected]>

PR-URL: #41667
Reviewed-By: Mestery <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Tobias Nießen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
RaisinTen authored Jan 29, 2022
1 parent 44f8b4f commit ef4c115
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions test/js-native-api/test_symbol/test2.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]);

0 comments on commit ef4c115

Please sign in to comment.