| 29 | } |
| 30 | |
| 31 | async function asyncProgressWorkerCallbackOverloads (bindingFunction) { |
| 32 | bindingFunction(common.mustCall()); |
| 33 | if (!checkAsyncHooks()) { |
| 34 | return; |
| 35 | } |
| 36 | |
| 37 | const hooks = common.installAysncHooks('cbResources'); |
| 38 | |
| 39 | const triggerAsyncId = asyncHooks.executionAsyncId(); |
| 40 | await new Promise((resolve, reject) => { |
| 41 | bindingFunction(common.mustCall(), 'cbResources'); |
| 42 | hooks.then(actual => { |
| 43 | assert.deepStrictEqual(actual, [ |
| 44 | { |
| 45 | eventName: 'init', |
| 46 | type: 'cbResources', |
| 47 | triggerAsyncId, |
| 48 | resource: {} |
| 49 | }, |
| 50 | { eventName: 'before' }, |
| 51 | { eventName: 'after' }, |
| 52 | { eventName: 'destroy' } |
| 53 | ]); |
| 54 | }).catch(common.mustNotCall()); |
| 55 | resolve(); |
| 56 | }); |
| 57 | } |
| 58 | |
| 59 | async function asyncProgressWorkerRecvOverloads (bindingFunction) { |
| 60 | const recvObject = { |