@@ -155,11 +155,7 @@ describe('functions', () => {
155
155
_inputs : [ ] ,
156
156
bindings : { } ,
157
157
log : ( message ) => logs . push ( message ) ,
158
- _metric : ( metric ) => metrics . push ( metric ) ,
159
- bind : ( val , cb ) => {
160
- bindingValues = val ;
161
- cb && cb ( val ) ;
162
- }
158
+ _metric : ( metric ) => metrics . push ( metric )
163
159
} ;
164
160
} ) ;
165
161
@@ -295,14 +291,16 @@ describe('functions', () => {
295
291
} ) ;
296
292
} ) ;
297
293
298
- it ( 'done passes data to binder ' , ( ) => {
294
+ it ( 'binding values propagate correctly ' , ( ) => {
299
295
var func = functions . createFunction ( ( context ) => {
300
- context . bindings = { result : 'res' } ;
296
+ context . bindings = { foo : 'abc' , bar : 123 } ;
301
297
context . done ( ) ;
302
298
} ) ;
303
299
304
- func ( context , ( results ) => {
305
- expect ( results ) . to . eql ( { result : 'res' } ) ;
300
+ func ( context , ( err , result ) => {
301
+ expect ( Object . keys ( result ) . length ) . to . equal ( 2 ) ;
302
+ expect ( result . returnValue ) . to . equal ( undefined ) ;
303
+ expect ( result . bindingValues ) . to . eql ( { foo : 'abc' , bar : 123 } ) ;
306
304
} ) ;
307
305
} ) ;
308
306
@@ -311,8 +309,8 @@ describe('functions', () => {
311
309
context . done ( 'err' ) ;
312
310
} ) ;
313
311
314
- func ( context , ( results ) => {
315
- expect ( results ) . to . eql ( 'err' ) ;
312
+ func ( context , ( err , result ) => {
313
+ expect ( err ) . to . eql ( 'err' ) ;
316
314
} ) ;
317
315
} ) ;
318
316
@@ -321,8 +319,8 @@ describe('functions', () => {
321
319
return Promise . reject ( 'err' ) ;
322
320
} ) ;
323
321
324
- func ( context , ( results ) => {
325
- expect ( results ) . to . eql ( 'err' ) ;
322
+ func ( context , ( err , result ) => {
323
+ expect ( err ) . to . eql ( 'err' ) ;
326
324
done ( ) ;
327
325
} ) ;
328
326
} ) ;
@@ -338,7 +336,7 @@ describe('functions', () => {
338
336
context . req = {
339
337
headers : { 'field' : 'val' }
340
338
} ;
341
- func ( context , ( results ) => {
339
+ func ( context , ( err , result ) => {
342
340
expect ( context . res . statusCode ) . to . equal ( 200 ) ;
343
341
expect ( context . res . body ) . to . equal ( 'test' ) ;
344
342
expect ( context . res . headers . header ) . to . equal ( 'val' ) ;
0 commit comments