napi-rs/examples/napi-compat-mode/__tests__/create-external.spec.ts
forehal a781a4f27e feat(cli): brand new cli tool with both cli and programmatical usage (#1492)
BREAKING CHANGE: requires node >= 16 and some cli options have been renamed
2023-04-06 11:04:53 +08:00

15 lines
466 B
TypeScript

import test from 'ava'
const bindings = require('../index.node')
test('should create external object and get it back', (t) => {
const fixture = 42
const externalObject = bindings.createExternal(42)
t.is(bindings.getExternalCount(externalObject), fixture)
})
test('should create external with size hint', (t) => {
const fixture = 42
const externalObject = bindings.createExternalWithHint(42)
t.is(bindings.getExternalCount(externalObject), fixture)
})