@@ -727,8 +727,9 @@ describe('TranslateCommand', () => {
727727 it ( 'should detect and route to translateFile() for file paths' , async ( ) => {
728728 // Mock fs to indicate file (not directory)
729729 const fs = jest . requireActual ( 'fs' ) ;
730+ const mockStats = { isDirectory : ( ) => false , isFile : ( ) => true } ;
730731 jest . spyOn ( fs , 'existsSync' ) . mockReturnValue ( true ) ;
731- jest . spyOn ( fs , 'statSync' ) . mockReturnValue ( { isDirectory : ( ) => false } as any ) ;
732+ jest . spyOn ( fs , 'statSync' ) . mockReturnValue ( mockStats as any ) ;
732733
733734 // Create a spy on translateFile
734735 const spy = jest . spyOn ( translateCommand as any , 'translateFile' )
@@ -740,7 +741,7 @@ describe('TranslateCommand', () => {
740741 } ) ;
741742
742743 expect ( result ) . toBe ( 'File translation result' ) ;
743- expect ( spy ) . toHaveBeenCalledWith ( '/path/to/file.txt' , { to : 'es' , output : '/out.txt' } ) ;
744+ expect ( spy ) . toHaveBeenCalledWith ( '/path/to/file.txt' , { to : 'es' , output : '/out.txt' } , mockStats ) ;
744745
745746 spy . mockRestore ( ) ;
746747 } ) ;
@@ -1375,7 +1376,7 @@ describe('TranslateCommand', () => {
13751376 output : '/out.txt' ,
13761377 } ) ;
13771378
1378- expect ( spy ) . toHaveBeenCalledWith ( 'C:\\Users\\Documents\\file.txt' , { to : 'es' , output : '/out.txt' } ) ;
1379+ expect ( spy ) . toHaveBeenCalledWith ( 'C:\\Users\\Documents\\file.txt' , { to : 'es' , output : '/out.txt' } , null ) ;
13791380 spy . mockRestore ( ) ;
13801381 } ) ;
13811382
@@ -1394,7 +1395,7 @@ describe('TranslateCommand', () => {
13941395 output : '/out.txt' ,
13951396 } ) ;
13961397
1397- expect ( spy ) . toHaveBeenCalledWith ( '/home/user/documents/file.txt' , { to : 'es' , output : '/out.txt' } ) ;
1398+ expect ( spy ) . toHaveBeenCalledWith ( '/home/user/documents/file.txt' , { to : 'es' , output : '/out.txt' } , null ) ;
13981399 spy . mockRestore ( ) ;
13991400 } ) ;
14001401
@@ -1461,7 +1462,7 @@ describe('TranslateCommand', () => {
14611462 output : '/out.txt' ,
14621463 } ) ;
14631464
1464- expect ( spy ) . toHaveBeenCalledWith ( 'folder\\subfolder\\file.txt' , { to : 'es' , output : '/out.txt' } ) ;
1465+ expect ( spy ) . toHaveBeenCalledWith ( 'folder\\subfolder\\file.txt' , { to : 'es' , output : '/out.txt' } , null ) ;
14651466 spy . mockRestore ( ) ;
14661467 } ) ;
14671468
@@ -1480,7 +1481,7 @@ describe('TranslateCommand', () => {
14801481 output : '/out.txt' ,
14811482 } ) ;
14821483
1483- expect ( spy ) . toHaveBeenCalledWith ( 'folder/subfolder/file.txt' , { to : 'es' , output : '/out.txt' } ) ;
1484+ expect ( spy ) . toHaveBeenCalledWith ( 'folder/subfolder/file.txt' , { to : 'es' , output : '/out.txt' } , null ) ;
14841485 spy . mockRestore ( ) ;
14851486 } ) ;
14861487
0 commit comments