@@ -13,22 +13,21 @@ function myMultiArgFunc(arg1, arg2, arg3) {
13
13
return 42 ;
14
14
}
15
15
16
- assert . strictEqual ( 42 , makeCallback ( process , common . mustCall ( function ( ) {
16
+ assert . strictEqual ( makeCallback ( process , common . mustCall ( function ( ) {
17
17
assert . strictEqual ( 0 , arguments . length ) ;
18
18
assert . strictEqual ( this , process ) ;
19
19
return 42 ;
20
- } ) ) ) ;
20
+ } ) ) , 42 ) ;
21
21
22
- assert . strictEqual ( 42 , makeCallback ( process , common . mustCall ( function ( x ) {
23
- assert . strictEqual ( 1 , arguments . length ) ;
22
+ assert . strictEqual ( makeCallback ( process , common . mustCall ( function ( x ) {
23
+ assert . strictEqual ( arguments . length , 1 ) ;
24
24
assert . strictEqual ( this , process ) ;
25
25
assert . strictEqual ( x , 1337 ) ;
26
26
return 42 ;
27
- } ) , 1337 ) ) ;
27
+ } ) , 1337 ) , 42 ) ;
28
28
29
- assert . strictEqual ( 42 ,
30
- makeCallback ( this ,
31
- common . mustCall ( myMultiArgFunc ) , 1 , 2 , 3 ) ) ;
29
+ assert . strictEqual ( makeCallback ( this ,
30
+ common . mustCall ( myMultiArgFunc ) , 1 , 2 , 3 ) , 42 ) ;
32
31
33
32
// TODO(node-api): napi_make_callback needs to support
34
33
// strings passed for the func argument
@@ -47,12 +46,12 @@ const recv = {
47
46
}),
48
47
};
49
48
50
- assert.strictEqual(42, makeCallback(recv, 'one'));
51
- assert.strictEqual(42, makeCallback(recv, 'two', 1337));
49
+ assert.strictEqual(makeCallback(recv, 'one'), 42 );
50
+ assert.strictEqual(makeCallback(recv, 'two', 1337), 42 );
52
51
53
52
// Check that callbacks on a receiver from a different context works.
54
53
const foreignObject = vm.runInNewContext('({ fortytwo() { return 42; } })');
55
- assert.strictEqual(42, makeCallback(foreignObject, 'fortytwo'));
54
+ assert.strictEqual(makeCallback(foreignObject, 'fortytwo'), 42 );
56
55
*/
57
56
58
57
// Check that the callback is made in the context of the receiver.
@@ -63,7 +62,7 @@ const target = vm.runInNewContext(`
63
62
return Object;
64
63
})
65
64
` ) ;
66
- assert . notStrictEqual ( Object , makeCallback ( process , target , Object ) ) ;
65
+ assert . notStrictEqual ( makeCallback ( process , target , Object ) , Object ) ;
67
66
68
67
// Runs in inner context.
69
68
const forward = vm . runInNewContext ( `
@@ -79,4 +78,4 @@ function endpoint($Object) {
79
78
return Object ;
80
79
}
81
80
82
- assert . strictEqual ( Object , makeCallback ( process , forward , endpoint ) ) ;
81
+ assert . strictEqual ( makeCallback ( process , forward , endpoint ) , Object ) ;
0 commit comments