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 = {
22
22
23
23
// should not contain 'goog'
24
24
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' ) ;
26
30
}
27
31
28
32
return BbPromise . resolve ( ) ;
Original file line number Diff line number Diff line change @@ -68,7 +68,13 @@ describe('Validate', () => {
68
68
expect ( ( ) => googleCommand . validateServiceName ( ) ) . toThrow ( Error ) ;
69
69
} ) ;
70
70
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' , ( ) => {
72
78
serverless . service . service = 'service-name' ;
73
79
74
80
expect ( ( ) => googleCommand . validateServiceName ( ) ) . not . toThrow ( Error ) ;
You can’t perform that action at this time.
0 commit comments