@@ -51,8 +51,12 @@ describe('File Upload', () => {
5151 const signedUploadUrlData = { uploadUrl : 'http://example.com/upload' , uploadUid : '123456789' } ;
5252 const zipName = 'test.zip' ;
5353 const zipPath = '/path/to/zip' ;
54- const defaultEnvironment = 'Default' ;
55- const environmentFlagInput = 'environmentFlagInput' ;
54+ const defaultEnvironment = { uid : 'testEnvUid' , name : 'Default' , frameworkPreset : 'OTHER' } ;
55+ const environmentMatchedByEnvironmentFlagInput = {
56+ uid : 'environmentFlagInput' ,
57+ name : 'environmentFlagInput' ,
58+ frameworkPreset : 'OTHER' ,
59+ } ;
5660
5761 beforeEach ( ( ) => {
5862 getEnvironmentStub = stub ( BaseClass . prototype , 'getEnvironment' ) ;
@@ -121,7 +125,7 @@ describe('File Upload', () => {
121125 expect ( createNewDeploymentStub . calledOnce ) . to . be . true ;
122126 expect ( createNewDeploymentStub . args [ 0 ] ) . to . deep . equal ( [
123127 true ,
124- defaultEnvironment ,
128+ defaultEnvironment . uid ,
125129 signedUploadUrlData . uploadUid ,
126130 ] ) ;
127131 expect ( prepareLaunchConfigStub . calledOnce ) . to . be . true ;
@@ -131,7 +135,7 @@ describe('File Upload', () => {
131135 } ) ;
132136
133137 it ( 'should run file upload flow successfully for existing project where environment and redeploy-latest flags are passed.' , async ( ) => {
134- getEnvironmentStub . resolves ( environmentFlagInput ) ;
138+ getEnvironmentStub . resolves ( environmentMatchedByEnvironmentFlagInput ) ;
135139
136140 let adapterConstructorOptions = {
137141 config : {
@@ -152,7 +156,7 @@ describe('File Upload', () => {
152156 expect ( createNewDeploymentStub . calledOnce ) . to . be . true ;
153157 expect ( createNewDeploymentStub . args [ 0 ] ) . to . deep . equal ( [
154158 true ,
155- environmentFlagInput ,
159+ environmentMatchedByEnvironmentFlagInput . uid ,
156160 signedUploadUrlData . uploadUid ,
157161 ] ) ;
158162 expect ( prepareLaunchConfigStub . calledOnce ) . to . be . true ;
@@ -179,15 +183,15 @@ describe('File Upload', () => {
179183 expect ( archiveStub . calledOnce ) . to . be . false ;
180184 expect ( uploadFileStub . calledOnce ) . to . be . false ;
181185 expect ( createNewDeploymentStub . calledOnce ) . to . be . true ;
182- expect ( createNewDeploymentStub . args [ 0 ] ) . to . deep . equal ( [ true , defaultEnvironment , undefined ] ) ;
186+ expect ( createNewDeploymentStub . args [ 0 ] ) . to . deep . equal ( [ true , defaultEnvironment . uid , undefined ] ) ;
183187 expect ( prepareLaunchConfigStub . calledOnce ) . to . be . true ;
184188 expect ( showLogsStub . calledOnce ) . to . be . true ;
185189 expect ( showDeploymentUrlStub . calledOnce ) . to . be . true ;
186190 expect ( showSuggestionStub . calledOnce ) . to . be . true ;
187191 } ) ;
188192
189193 it ( 'should run file upload flow successfully for existing project where environment and redeploy-last-upload flags are passed' , async ( ) => {
190- getEnvironmentStub . resolves ( environmentFlagInput ) ;
194+ getEnvironmentStub . resolves ( environmentMatchedByEnvironmentFlagInput ) ;
191195
192196 let adapterConstructorOptions = {
193197 config : {
@@ -205,7 +209,7 @@ describe('File Upload', () => {
205209 expect ( archiveStub . calledOnce ) . to . be . false ;
206210 expect ( uploadFileStub . calledOnce ) . to . be . false ;
207211 expect ( createNewDeploymentStub . calledOnce ) . to . be . true ;
208- expect ( createNewDeploymentStub . args [ 0 ] ) . to . deep . equal ( [ true , environmentFlagInput , undefined ] ) ;
212+ expect ( createNewDeploymentStub . args [ 0 ] ) . to . deep . equal ( [ true , environmentMatchedByEnvironmentFlagInput . uid , undefined ] ) ;
209213 expect ( prepareLaunchConfigStub . calledOnce ) . to . be . true ;
210214 expect ( showLogsStub . calledOnce ) . to . be . true ;
211215 expect ( showDeploymentUrlStub . calledOnce ) . to . be . true ;
@@ -246,7 +250,7 @@ describe('File Upload', () => {
246250 } ) ;
247251
248252 it ( 'should exit with an error message when both --redeploy-last-upload and --redeploy-latest flags are passed alongwith environment flag' , async ( ) => {
249- getEnvironmentStub . resolves ( environmentFlagInput ) ;
253+ getEnvironmentStub . resolves ( environmentMatchedByEnvironmentFlagInput ) ;
250254
251255 let adapterConstructorOptions = {
252256 config : {
@@ -305,15 +309,15 @@ describe('File Upload', () => {
305309 expect ( uploadFileStub . calledOnce ) . to . be . true ;
306310 expect ( uploadFileStub . args [ 0 ] ) . to . deep . equal ( [ zipName , zipPath , signedUploadUrlData ] ) ;
307311 expect ( createNewDeploymentStub . calledOnce ) . to . be . true ;
308- expect ( createNewDeploymentStub . args [ 0 ] ) . to . deep . equal ( [ true , defaultEnvironment , signedUploadUrlData . uploadUid ] ) ;
312+ expect ( createNewDeploymentStub . args [ 0 ] ) . to . deep . equal ( [ true , defaultEnvironment . uid , signedUploadUrlData . uploadUid ] ) ;
309313 expect ( prepareLaunchConfigStub . calledOnce ) . to . be . true ;
310314 expect ( showLogsStub . calledOnce ) . to . be . true ;
311315 expect ( showDeploymentUrlStub . calledOnce ) . to . be . true ;
312316 expect ( showSuggestionStub . calledOnce ) . to . be . true ;
313317 } ) ;
314318
315319 it ( 'should show prompt and successfully redeploy with "new file" if the option to redeploy with new file is selected, when --redeploy-latest and --redeploy-last-upload flags are not passed and environment flag passed' , async ( ) => {
316- getEnvironmentStub . resolves ( environmentFlagInput ) ;
320+ getEnvironmentStub . resolves ( environmentMatchedByEnvironmentFlagInput ) ;
317321 let adapterConstructorOptions = {
318322 config : {
319323 isExistingProject : true ,
@@ -339,7 +343,7 @@ describe('File Upload', () => {
339343 expect ( uploadFileStub . calledOnce ) . to . be . true ;
340344 expect ( uploadFileStub . args [ 0 ] ) . to . deep . equal ( [ zipName , zipPath , signedUploadUrlData ] ) ;
341345 expect ( createNewDeploymentStub . calledOnce ) . to . be . true ;
342- expect ( createNewDeploymentStub . args [ 0 ] ) . to . deep . equal ( [ true , environmentFlagInput , signedUploadUrlData . uploadUid ] ) ;
346+ expect ( createNewDeploymentStub . args [ 0 ] ) . to . deep . equal ( [ true , environmentMatchedByEnvironmentFlagInput . uid , signedUploadUrlData . uploadUid ] ) ;
343347 expect ( prepareLaunchConfigStub . calledOnce ) . to . be . true ;
344348 expect ( showLogsStub . calledOnce ) . to . be . true ;
345349 expect ( showDeploymentUrlStub . calledOnce ) . to . be . true ;
@@ -372,15 +376,15 @@ describe('File Upload', () => {
372376 expect ( archiveStub . calledOnce ) . to . be . false ;
373377 expect ( uploadFileStub . calledOnce ) . to . be . false ;
374378 expect ( createNewDeploymentStub . calledOnce ) . to . be . true ;
375- expect ( createNewDeploymentStub . args [ 0 ] ) . to . deep . equal ( [ true , defaultEnvironment , undefined ] ) ;
379+ expect ( createNewDeploymentStub . args [ 0 ] ) . to . deep . equal ( [ true , defaultEnvironment . uid , undefined ] ) ;
376380 expect ( prepareLaunchConfigStub . calledOnce ) . to . be . true ;
377381 expect ( showLogsStub . calledOnce ) . to . be . true ;
378382 expect ( showDeploymentUrlStub . calledOnce ) . to . be . true ;
379383 expect ( showSuggestionStub . calledOnce ) . to . be . true ;
380384 } ) ;
381385
382386 it ( 'should show prompt and successfully redeploy with "last file upload" if the option to redeploy with last file upload is selected, when --redeploy-latest and --redeploy-last-upload flags are not passed and environment flag passed' , async ( ) => {
383- getEnvironmentStub . resolves ( environmentFlagInput ) ;
387+ getEnvironmentStub . resolves ( environmentMatchedByEnvironmentFlagInput ) ;
384388
385389 let adapterConstructorOptions = {
386390 config : {
@@ -405,7 +409,7 @@ describe('File Upload', () => {
405409 expect ( archiveStub . calledOnce ) . to . be . false ;
406410 expect ( uploadFileStub . calledOnce ) . to . be . false ;
407411 expect ( createNewDeploymentStub . calledOnce ) . to . be . true ;
408- expect ( createNewDeploymentStub . args [ 0 ] ) . to . deep . equal ( [ true , environmentFlagInput , undefined ] ) ;
412+ expect ( createNewDeploymentStub . args [ 0 ] ) . to . deep . equal ( [ true , environmentMatchedByEnvironmentFlagInput . uid , undefined ] ) ;
409413 expect ( prepareLaunchConfigStub . calledOnce ) . to . be . true ;
410414 expect ( showLogsStub . calledOnce ) . to . be . true ;
411415 expect ( showDeploymentUrlStub . calledOnce ) . to . be . true ;
@@ -451,6 +455,7 @@ describe('File Upload', () => {
451455 } ) ;
452456
453457 it ( 'should exit if "No" is selected for prompt to redeploy, when --redeploy-latest and --redeploy-last-upload flags are not passed and environment flag is passed' , async ( ) => {
458+ getEnvironmentStub . resolves ( defaultEnvironment ) ;
454459 let adapterConstructorOptions = {
455460 config : {
456461 isExistingProject : true ,
0 commit comments