napi-rs/examples/napi/__test__/object-attr.spec.ts

16 lines
283 B
TypeScript
Raw Normal View History

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