File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change 11'use strict' ;
22
3+ const _ = require ( 'lodash' ) ;
34const BbPromise = require ( 'bluebird' ) ;
45
56module . exports = {
67 setDefaults ( ) {
7- this . options . stage = this . options . stage
8+ this . options . stage = _ . get ( this , 'options.stage' )
9+ || _ . get ( this , 'serverless.service.provider.stage' )
810 || 'dev' ;
9- this . options . region = this . options . region
11+ this . options . region = _ . get ( this , 'options.region' )
12+ || _ . get ( this , 'serverless.service.provider.region' )
1013 || 'us-central1' ;
1114
1215 return BbPromise . resolve ( ) ;
Original file line number Diff line number Diff line change @@ -31,5 +31,17 @@ describe('Utils', () => {
3131 expect ( googleCommand . options . region ) . toEqual ( 'my-region' ) ;
3232 } ) ;
3333 } ) ;
34+
35+ it ( 'should set the provider values for stage and region if provided' , ( ) => {
36+ googleCommand . serverless . service . provider = {
37+ stage : 'my-stage' ,
38+ region : 'my-region' ,
39+ } ;
40+
41+ return googleCommand . setDefaults ( ) . then ( ( ) => {
42+ expect ( googleCommand . options . stage ) . toEqual ( 'my-stage' ) ;
43+ expect ( googleCommand . options . region ) . toEqual ( 'my-region' ) ;
44+ } ) ;
45+ } ) ;
3446 } ) ;
3547} ) ;
You can’t perform that action at this time.
0 commit comments