2020-07-03 01:36:45 +09:00
|
|
|
const test = require('ava')
|
|
|
|
|
|
|
|
const bindings = require('../index.node')
|
|
|
|
|
2020-07-03 01:31:50 +09:00
|
|
|
test('should call the function', (t) => {
|
|
|
|
bindings.testCallFunction((arg1, arg2) => {
|
|
|
|
t.is(`${arg1} ${arg2}`, 'hello world')
|
2020-07-03 01:36:45 +09:00
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2020-07-03 01:31:50 +09:00
|
|
|
test('should set "this" properly', (t) => {
|
2020-07-03 01:36:45 +09:00
|
|
|
const obj = {}
|
2020-07-03 01:31:50 +09:00
|
|
|
bindings.testCallFunctionWithThis.call(obj, function () {
|
|
|
|
t.is(this, obj)
|
2020-07-03 01:36:45 +09:00
|
|
|
})
|
|
|
|
})
|