napi-rs/examples/napi/__tests__/object-attr.spec.ts
LongYinan 36581336c6
feat(napi): pass the rest of async tests (#1792)
Pass the rest of async tests, including await the JavaScript Promise in the Rust side, and the worker_threads tests.
2023-11-07 01:46:43 +08:00

15 lines
306 B
TypeScript

import test from 'ava'
const { NotWritableClass } = (await import('../index.js')).default
test('Not Writable Class', (t) => {
const obj = new NotWritableClass('1')
t.throws(() => {
obj.name = '2'
})
obj.setName('2')
t.is(obj.name, '2')
t.throws(() => {
obj.setName = () => {}
})
})