@@ -19,6 +19,16 @@ describe('AWS Lambda Function', function (){
1919 } ) ;
2020 } ) ;
2121
22+ describe ( 'send event pay load from a file' , function ( ) {
23+ it ( 'should call succeed and parse JSON' , function ( ) {
24+ spyOn ( lambdaRunner . aws , 'succeed' ) . andCallThrough ( ) ;
25+ var event = 'file://tests/fixtures/event.json' ;
26+ lambdaRunner . run ( 'lambda-example' , 'parseEvent' , event ) ;
27+ expect ( lambdaRunner . aws . succeed ) . toHaveBeenCalledWith ( 'works' ) ;
28+ } ) ;
29+ } ) ;
30+
31+
2232 describe ( 'failed execution' , function ( ) {
2333 it ( 'should call fail' , function ( ) {
2434 spyOn ( lambdaRunner . aws , 'fail' ) . andCallThrough ( ) ;
@@ -38,9 +48,23 @@ describe('AWS Lambda Function', function (){
3848 describe ( 'invalid lambda function' , function ( ) {
3949 it ( 'should call console.error with invalid module' , function ( ) {
4050 spyOn ( console , 'error' ) ;
51+ spyOn ( console , 'trace' ) ;
4152 var lambdaName = 'random' ;
4253 lambdaRunner . run ( lambdaName ) ;
4354 expect ( console . error ) . toHaveBeenCalledWith ( 'Invalid module: ' + lambdaName ) ;
55+ var exception = { code : 'MODULE_NOT_FOUND' } ;
56+ expect ( console . trace ) . toHaveBeenCalledWith ( exception ) ;
57+ } ) ;
58+ } ) ;
59+
60+ describe ( 'broken lambda function' , function ( ) {
61+ it ( 'should call console.error with invalid module' , function ( ) {
62+ spyOn ( console , 'error' ) ;
63+ spyOn ( console , 'trace' ) ;
64+ var lambdaName = 'lambda-broken-js' ;
65+ lambdaRunner . run ( lambdaName ) ;
66+ expect ( console . error ) . toHaveBeenCalledWith ( 'Invalid module: ' + lambdaName ) ;
67+ expect ( console . trace ) . toHaveBeenCalled ( ) ;
4468 } ) ;
4569 } ) ;
4670
0 commit comments