File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,11 @@ module.exports = {
2222
2323 // should not contain 'goog'
2424 if ( name . match ( / g o o g / ) ) {
25- throw Error ( 'Your service should not contain the string "goog"' ) ;
25+ throw new Error ( 'Your service should not contain the string "goog"' ) ;
26+ }
27+
28+ if ( name . match ( / _ + / ) ) {
29+ throw new Error ( 'Your service name should not include underscores' ) ;
2630 }
2731
2832 return BbPromise . resolve ( ) ;
Original file line number Diff line number Diff line change @@ -68,7 +68,13 @@ describe('Validate', () => {
6868 expect ( ( ) => googleCommand . validateServiceName ( ) ) . toThrow ( Error ) ;
6969 } ) ;
7070
71- it ( 'should not throw an error if the service name does not contain the string "goog"' , ( ) => {
71+ it ( 'should throw an error if the service name contains underscores' , ( ) => {
72+ serverless . service . service = 'service_name' ;
73+
74+ expect ( ( ) => googleCommand . validateServiceName ( ) ) . toThrow ( Error ) ;
75+ } ) ;
76+
77+ it ( 'should not throw an error if the service name is valid' , ( ) => {
7278 serverless . service . service = 'service-name' ;
7379
7480 expect ( ( ) => googleCommand . validateServiceName ( ) ) . not . toThrow ( Error ) ;
You can’t perform that action at this time.
0 commit comments