napi-rs/examples/napi/__tests__/object-attr.spec.ts
2023-06-17 17:03:57 +08:00

15 lines
277 B
TypeScript

import test from 'ava'
import { NotWritableClass } from '..'
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 = () => {}
})
})