(binding, succeed)
| 3 | const assert = require('assert'); |
| 4 | |
| 5 | function test (binding, succeed) { |
| 6 | return new Promise((resolve) => |
| 7 | // Can't pass an arrow function to doWork because that results in an |
| 8 | // undefined context inside its body when the function gets called. |
| 9 | binding.doWork(succeed, function (e) { |
| 10 | setImmediate(() => { |
| 11 | // If the work is supposed to fail, make sure there's an error. |
| 12 | assert.strictEqual(succeed || e.message === 'test error', true); |
| 13 | assert.strictEqual(binding.workerGone, false); |
| 14 | binding.deleteWorker(); |
| 15 | assert.strictEqual(binding.workerGone, true); |
| 16 | resolve(); |
| 17 | }); |
| 18 | })); |
| 19 | } |
| 20 | |
| 21 | module.exports = require('./common').runTest(async binding => { |
| 22 | await test(binding.persistentasyncworker, false); |
no outgoing calls
no test coverage detected