@@ -57,7 +57,7 @@ describe('extensions', function () {
57
57
} )
58
58
} )
59
59
} )
60
- describe ( 'Promise.denodeify(fn)' , function ( ) {
60
+ describe ( 'Promise.denodeify(fn, [argumentCount] )' , function ( ) {
61
61
it ( 'returns a function that uses promises instead of callbacks' , function ( done ) {
62
62
function wrap ( val , key , callback ) {
63
63
return callback ( null , { val : val , key : key } )
@@ -81,6 +81,18 @@ describe('extensions', function () {
81
81
done ( )
82
82
} )
83
83
} )
84
+ it ( 'with an argumentCount it ignores extra arguments' , function ( done ) {
85
+ function wrap ( val , key , callback ) {
86
+ return callback ( null , { val : val , key : key } )
87
+ }
88
+ var pwrap = Promise . denodeify ( wrap , 2 )
89
+ pwrap ( sentinel , 'foo' , 'wtf' )
90
+ . then ( function ( wrapper ) {
91
+ assert ( wrapper . val === sentinel )
92
+ assert ( wrapper . key === 'foo' )
93
+ done ( )
94
+ } )
95
+ } )
84
96
} )
85
97
describe ( 'Promise.nodeify(fn)' , function ( ) {
86
98
it ( 'converts a promise returning function into a callback function' , function ( done ) {
@@ -301,4 +313,4 @@ describe('extensions', function () {
301
313
} )
302
314
} )
303
315
} )
304
- } )
316
+ } )
0 commit comments