Skip to content

Commit ce959cf

Browse files
committed
fixup! n-api: support for object freeze/seal
1 parent e7c2fe9 commit ce959cf

File tree

1 file changed

+8
-7
lines changed
  • test/js-native-api/test_object

1 file changed

+8
-7
lines changed

test/js-native-api/test_object/test.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -284,15 +284,16 @@ assert.deepStrictEqual(test_object.TestGetProperty(), {
284284
assert.strictEqual(Object.isSealed(obj), true);
285285

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

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

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

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

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

309310
assert.throws(() => {
310-
obj['w'] = 15
311+
obj.w = 15;
311312
}, /Cannot add property w, object is not extensible/);
312313

313314
assert.throws(() => {
314-
delete obj['x']
315+
delete obj.x;
315316
}, /Cannot delete property 'x' of #<Object>/);
316317
}

0 commit comments

Comments
 (0)