LongYinan 583a2ba5c8
chore(triples): update target list (#2879)
* chore(triples): update target list

* convert compat tests to esm

* Fix node 20 test
2025-08-15 18:31:56 +08:00

27 lines
528 B
TypeScript

import ava from 'ava'
import { napiVersion } from '../napi-version'
// @ts-expect-error
import bindings from '../../index.node'
const test = napiVersion >= 8 ? ava : ava.skip
test('should be able to freeze object', (t) => {
const obj: any = {}
bindings.testFreezeObject(obj)
t.true(Object.isFrozen(obj))
t.throws(() => {
obj.a = 1
})
})
test('should be able to seal object', (t) => {
const obj: any = {}
bindings.testSealObject(obj)
t.true(Object.isSealed(obj))
t.throws(() => {
obj.a = 1
})
})