@@ -187,6 +187,53 @@ void describe('Sandbox to check if region is bootstrapped', () => {
187187 openMock . mock . calls [ 0 ] . arguments [ 0 ] ,
188188 getBootstrapUrl ( region )
189189 ) ;
190+ assert . strictEqual ( printer . log . mock . callCount ( ) , 1 ) ;
191+ assert . strictEqual (
192+ printer . log . mock . calls [ 0 ] . arguments [ 0 ] ,
193+ 'The given region has not been bootstrapped. Sign in to console as a Root user or Admin to complete the bootstrap process, then restart the sandbox.'
194+ ) ;
195+ assert . strictEqual ( printer . log . mock . calls [ 0 ] . arguments [ 1 ] , undefined ) ;
196+ } ) ;
197+
198+ void it ( 'when region has not bootstrapped, and opening console url fails prints url to initiate bootstrap' , async ( ) => {
199+ ssmClientSendMock . mock . mockImplementationOnce ( ( ) => {
200+ throw new ParameterNotFound ( {
201+ $metadata : { } ,
202+ message : 'Parameter not found' ,
203+ } ) ;
204+ } ) ;
205+
206+ openMock . mock . mockImplementationOnce ( ( ) =>
207+ Promise . reject ( new Error ( 'open error' ) )
208+ ) ;
209+
210+ await sandboxInstance . start ( {
211+ dir : 'testDir' ,
212+ exclude : [ 'exclude1' , 'exclude2' ] ,
213+ } ) ;
214+
215+ assert . strictEqual ( ssmClientSendMock . mock . callCount ( ) , 1 ) ;
216+ assert . strictEqual ( openMock . mock . callCount ( ) , 1 ) ;
217+ assert . strictEqual (
218+ openMock . mock . calls [ 0 ] . arguments [ 0 ] ,
219+ getBootstrapUrl ( region )
220+ ) ;
221+ assert . strictEqual ( printer . log . mock . callCount ( ) , 3 ) ;
222+ assert . strictEqual (
223+ printer . log . mock . calls [ 0 ] . arguments [ 0 ] ,
224+ 'The given region has not been bootstrapped. Sign in to console as a Root user or Admin to complete the bootstrap process, then restart the sandbox.'
225+ ) ;
226+ assert . strictEqual ( printer . log . mock . calls [ 0 ] . arguments [ 1 ] , undefined ) ;
227+ assert . strictEqual (
228+ printer . log . mock . calls [ 1 ] . arguments [ 0 ] ,
229+ 'Unable to open bootstrap url, open error'
230+ ) ;
231+ assert . strictEqual ( printer . log . mock . calls [ 1 ] . arguments [ 1 ] , LogLevel . DEBUG ) ;
232+ assert . strictEqual (
233+ printer . log . mock . calls [ 2 ] . arguments [ 0 ] ,
234+ `Open ${ getBootstrapUrl ( region ) } in the browser.`
235+ ) ;
236+ assert . strictEqual ( printer . log . mock . calls [ 2 ] . arguments [ 1 ] , undefined ) ;
190237 } ) ;
191238
192239 void it ( 'when user does not have proper credentials throw user error' , async ( ) => {
0 commit comments