@@ -320,7 +320,7 @@ describe('delete command', () => {
320320 } )
321321 } )
322322
323- it ( 'should handle 404 Not Found response' , async ( ) => {
323+ it ( 'should handle 404 Not Found response with specific not-found message ' , async ( ) => {
324324 requestAPIStub . resolves ( {
325325 status : 404 ,
326326 data : { error : 'Not Found' }
@@ -335,11 +335,38 @@ describe('delete command', () => {
335335
336336 sinon . assert . calledWith (
337337 errorStub ,
338- sinon . match ( / F a i l e d t o d e l e t e c o n n e c t o r : H T T P 4 0 4 / ) ,
338+ sinon . match ( / C o n n e c t o r ' t e s t - c o n n e c t o r ' n o t f o u n d \. I t m a y h a v e a l r e a d y b e e n d e l e t e d o r d o e s n o t e x i s t \. / ) ,
339339 sinon . match ( { exit : 1 } )
340340 )
341341 } )
342342
343+ it ( 'should log verbose error details on 404 when verbose flag is set' , async ( ) => {
344+ parseStub . restore ( )
345+ parseStub = sinon . stub ( deleteCommand , 'parse' as any ) . resolves ( {
346+ args : { connector : 'test-connector' } ,
347+ flags : {
348+ verbose : true ,
349+ force : true ,
350+ help : false
351+ }
352+ } )
353+
354+ requestAPIStub . resolves ( {
355+ status : 404 ,
356+ data : { error : 'Not Found' }
357+ } )
358+
359+ try {
360+ await deleteCommand . run ( )
361+ expect . fail ( 'Should have thrown an error' )
362+ } catch ( error ) {
363+ // Expected
364+ }
365+
366+ sinon . assert . calledWith ( logStub , sinon . match ( / E r r o r D e t a i l s : / ) )
367+ sinon . assert . calledWith ( logStub , sinon . match ( / n o t f o u n d / ) )
368+ } )
369+
343370 it ( 'should handle 403 Forbidden response' , async ( ) => {
344371 requestAPIStub . resolves ( {
345372 status : 403 ,
0 commit comments