@@ -27,23 +27,28 @@ describe('Validate', () => {
2727  describe ( '#validate()' ,  ( )  =>  { 
2828    let  validateServicePathStub ; 
2929    let  validateServiceNameStub ; 
30+     let  validateHandlersStub ; 
3031
3132    beforeEach ( ( )  =>  { 
3233      validateServicePathStub  =  sinon . stub ( googleCommand ,  'validateServicePath' ) 
3334        . returns ( BbPromise . resolve ( ) ) ; 
3435      validateServiceNameStub  =  sinon . stub ( googleCommand ,  'validateServiceName' ) 
3536        . returns ( BbPromise . resolve ( ) ) ; 
37+       validateHandlersStub  =  sinon . stub ( googleCommand ,  'validateHandlers' ) 
38+         . returns ( BbPromise . resolve ( ) ) ; 
3639    } ) ; 
3740
3841    afterEach ( ( )  =>  { 
3942      googleCommand . validateServicePath . restore ( ) ; 
4043      googleCommand . validateServiceName . restore ( ) ; 
44+       googleCommand . validateHandlers . restore ( ) ; 
4145    } ) ; 
4246
4347    it ( 'should run promise chain' ,  ( )  =>  googleCommand 
4448      . validate ( ) . then ( ( )  =>  { 
4549        expect ( validateServicePathStub . calledOnce ) . toEqual ( true ) ; 
4650        expect ( validateServiceNameStub . calledAfter ( validateServicePathStub ) ) ; 
51+         expect ( validateHandlersStub . calledAfter ( validateServiceNameStub ) ) ; 
4752      } ) ) ; 
4853  } ) ; 
4954
@@ -80,4 +85,29 @@ describe('Validate', () => {
8085      expect ( ( )  =>  googleCommand . validateServiceName ( ) ) . not . toThrow ( Error ) ; 
8186    } ) ; 
8287  } ) ; 
88+ 
89+   describe ( '#validateHandlers()' ,  ( )  =>  { 
90+     it ( 'should throw an error if the handler name contains an invalid character' ,  ( )  =>  { 
91+       googleCommand . serverless . service . functions  =  { 
92+         foo : { 
93+           handler : 'invalid.handler' , 
94+         } , 
95+         bar : { 
96+           handler : 'invalid/handler' , 
97+         } , 
98+       } ; 
99+ 
100+       expect ( ( )  =>  googleCommand . validateHandlers ( ) ) . toThrow ( Error ) ; 
101+     } ) ; 
102+ 
103+     it ( 'should not throw an error if the function handler is valid' ,  ( )  =>  { 
104+       googleCommand . serverless . service . functions  =  { 
105+         foo : { 
106+           handler : 'validHandler' , 
107+         } , 
108+       } ; 
109+ 
110+       expect ( ( )  =>  googleCommand . validateHandlers ( ) ) . not . toThrow ( Error ) ; 
111+     } ) ; 
112+   } ) ; 
83113} ) ; 
0 commit comments