@@ -66,6 +66,14 @@ function test(binding) {
66
66
assert . strictEqual ( typeof this , 'object' ) ;
67
67
assert . strictEqual ( this . data , 'test data' ) ;
68
68
} , 'test data' ) ;
69
+
70
+ binding . asyncworker . doWorkWithResult ( true , { } , function ( succeed , succeedString ) {
71
+ assert ( arguments . length == 2 ) ;
72
+ assert ( succeed ) ;
73
+ assert ( succeedString == "ok" ) ;
74
+ assert . strictEqual ( typeof this , 'object' ) ;
75
+ assert . strictEqual ( this . data , 'test data' ) ;
76
+ } , 'test data' ) ;
69
77
return ;
70
78
}
71
79
@@ -91,6 +99,30 @@ function test(binding) {
91
99
} ) . catch ( common . mustNotCall ( ) ) ;
92
100
}
93
101
102
+ {
103
+ const hooks = installAsyncHooksForTest ( ) ;
104
+ const triggerAsyncId = async_hooks . executionAsyncId ( ) ;
105
+ binding . asyncworker . doWorkWithResult ( true , { foo : 'foo' } , function ( succeed , succeedString ) {
106
+ assert ( arguments . length == 2 ) ;
107
+ assert ( succeed ) ;
108
+ assert ( succeedString == "ok" ) ;
109
+ assert . strictEqual ( typeof this , 'object' ) ;
110
+ assert . strictEqual ( this . data , 'test data' ) ;
111
+ } , 'test data' ) ;
112
+
113
+ hooks . then ( actual => {
114
+ assert . deepStrictEqual ( actual , [
115
+ { eventName : 'init' ,
116
+ type : 'TestResource' ,
117
+ triggerAsyncId : triggerAsyncId ,
118
+ resource : { foo : 'foo' } } ,
119
+ { eventName : 'before' } ,
120
+ { eventName : 'after' } ,
121
+ { eventName : 'destroy' }
122
+ ] ) ;
123
+ } ) . catch ( common . mustNotCall ( ) ) ;
124
+ }
125
+
94
126
{
95
127
const hooks = installAsyncHooksForTest ( ) ;
96
128
const triggerAsyncId = async_hooks . executionAsyncId ( ) ;
0 commit comments