napi-rs/examples/napi-compat-mode/__tests__/cleanup-env.spec.ts

18 lines
386 B
TypeScript
Raw Normal View History

2020-10-04 17:02:04 +09:00
import test from 'ava'
const bindings = require('../index.node')
test('should be able to add cleanup hook', (t) => {
t.notThrows(() => {
const ret = bindings.addCleanupHook()
t.is(typeof ret, 'object')
})
})
test('should be able to remove cleanup hook', (t) => {
t.notThrows(() => {
const ret = bindings.addCleanupHook()
bindings.removeCleanupHook(ret)
})
})