Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
test: improves indexed properties test by comparing object descriptors
  • Loading branch information
conectado committed Oct 7, 2018
commit a815617c0742ba6e189b2a90292760bf9130c969
12 changes: 8 additions & 4 deletions test/parallel/test-vm-context-property-forwarding.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,12 @@ vm.runInContext('y = 4;', ctx);
assert.strictEqual(sandbox.y, 4);
assert.strictEqual(ctx.y, 4);

const x = vm.createContext({ get a() { return 5; } });
const x = { get a() { return 5; } };
const pd_expected = Object.getOwnPropertyDescriptor(x, 'a');
const ctx2 = vm.createContext(x);
const pd_actual = Object.getOwnPropertyDescriptor(ctx2, 'a');

assert.strictEqual(x.a, 5);
delete x.a;
assert.strictEqual(x.a, undefined);
assert.deepStrictEqual(pd_actual, pd_expected);
assert.strictEqual(ctx2.a, 5);
delete ctx2.a;
assert.strictEqual(ctx2.a, undefined);