napi-rs/test_module/__test__/tsfn_error.spec.js

17 lines
407 B
JavaScript
Raw Normal View History

const test = require('ava')
const bindings = require('../index.node')
test('should call callback with the first arguments as an Error', async (t) => {
return new Promise((resolve, reject) => {
bindings.testTsfnError((err) => {
try {
t.is(err instanceof Error, true)
t.is(err.message, 'invalid')
resolve()
} catch (err) {
reject(err)
}
})
})
})