@@ -24,22 +24,28 @@ describe('code delete', () => {
2424 it ( 'deletes without prompting when --force is set' , async ( ) => {
2525 const command : any = await createCommand ( { force : true } , { codeVersion : 'v1' } ) ;
2626
27+ const instance = { config : { hostname : 'example.com' } } ;
28+
2729 sinon . stub ( command , 'requireOAuthCredentials' ) . returns ( void 0 ) ;
2830 sinon . stub ( command , 'resolvedConfig' ) . get ( ( ) => ( { values : { hostname : 'example.com' } } ) ) ;
31+ sinon . stub ( command , 'instance' ) . get ( ( ) => instance ) ;
2932 sinon . stub ( command , 'log' ) . returns ( void 0 ) ;
3033
3134 const deleteStub = sinon . stub ( ) . resolves ( void 0 ) ;
3235 command . operations = { ...command . operations , deleteCodeVersion : deleteStub } ;
3336
3437 await command . run ( ) ;
35- expect ( deleteStub . calledOnce ) . to . equal ( true ) ;
38+ expect ( deleteStub . calledOnceWithExactly ( instance , 'v1' ) ) . to . equal ( true ) ;
3639 } ) ;
3740
3841 it ( 'does not delete when prompt is declined' , async ( ) => {
3942 const command : any = await createCommand ( { } , { codeVersion : 'v1' } ) ;
4043
44+ const instance = { config : { hostname : 'example.com' } } ;
45+
4146 sinon . stub ( command , 'requireOAuthCredentials' ) . returns ( void 0 ) ;
4247 sinon . stub ( command , 'resolvedConfig' ) . get ( ( ) => ( { values : { hostname : 'example.com' } } ) ) ;
48+ sinon . stub ( command , 'instance' ) . get ( ( ) => instance ) ;
4349 sinon . stub ( command , 'log' ) . returns ( void 0 ) ;
4450
4551 const deleteStub = sinon . stub ( ) . rejects ( new Error ( 'Unexpected delete' ) ) ;
@@ -55,8 +61,11 @@ describe('code delete', () => {
5561 it ( 'deletes when prompt is accepted' , async ( ) => {
5662 const command : any = await createCommand ( { } , { codeVersion : 'v1' } ) ;
5763
64+ const instance = { config : { hostname : 'example.com' } } ;
65+
5866 sinon . stub ( command , 'requireOAuthCredentials' ) . returns ( void 0 ) ;
5967 sinon . stub ( command , 'resolvedConfig' ) . get ( ( ) => ( { values : { hostname : 'example.com' } } ) ) ;
68+ sinon . stub ( command , 'instance' ) . get ( ( ) => instance ) ;
6069 sinon . stub ( command , 'log' ) . returns ( void 0 ) ;
6170
6271 const deleteStub = sinon . stub ( ) . resolves ( void 0 ) ;
@@ -66,6 +75,6 @@ describe('code delete', () => {
6675 await command . run ( ) ;
6776
6877 expect ( confirmStub . calledOnce ) . to . equal ( true ) ;
69- expect ( deleteStub . calledOnce ) . to . equal ( true ) ;
78+ expect ( deleteStub . calledOnceWithExactly ( instance , 'v1' ) ) . to . equal ( true ) ;
7079 } ) ;
7180} ) ;
0 commit comments