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
fixup! n-api: support for object freeze/seal
  • Loading branch information
codebytere committed Oct 7, 2020
commit ce959cfdb908bf8737ee7e0ec9c43d21d83937a2
15 changes: 8 additions & 7 deletions test/js-native-api/test_object/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,15 +284,16 @@ assert.deepStrictEqual(test_object.TestGetProperty(), {
assert.strictEqual(Object.isSealed(obj), true);

assert.throws(() => {
obj['w'] = 'd'
obj.w = 'd';
}, /Cannot add property w, object is not extensible/);

assert.throws(() => {
delete obj['x']
delete obj.x;
}, /Cannot delete property 'x' of #<Object>/);

// Sealed objects allow updating existing properties.
assert.doesNotThrow(() => { obj['x'] = 'd' });
// Sealed objects allow updating existing properties,
// so this should not throw.
obj.x = 'd';
}

{
Expand All @@ -303,14 +304,14 @@ assert.deepStrictEqual(test_object.TestGetProperty(), {
assert.strictEqual(Object.isFrozen(obj), true);

assert.throws(() => {
obj['x'] = 10
obj.x = 10;
}, /Cannot assign to read only property 'x' of object '#<Object>/);

assert.throws(() => {
obj['w'] = 15
obj.w = 15;
}, /Cannot add property w, object is not extensible/);

assert.throws(() => {
delete obj['x']
delete obj.x;
}, /Cannot delete property 'x' of #<Object>/);
}
Comment thread
codebytere marked this conversation as resolved.
Outdated