napi-rs/test_module/__test__/tsfn_error.spec.js
2020-06-28 22:47:08 +08:00

16 lines
407 B
JavaScript

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)
}
})
})
})