@@ -15,7 +15,7 @@ import {
1515 readFileContent ,
1616 writeFileContent ,
1717 appendFileContent ,
18- writeOrUpdateFileContent ,
18+ createOrAppendFileContent ,
1919 // Search & filtering functions
2020 searchFilesWithValidation ,
2121 // File editing functions
@@ -344,14 +344,14 @@ describe('Lib Functions', () => {
344344 } ) ;
345345 } ) ;
346346
347- describe ( 'writeOrUpdateFileContent ' , ( ) => {
347+ describe ( 'createOrAppendFileContent ' , ( ) => {
348348 it ( 'creates new file if it does not exist' , async ( ) => {
349349 const error = new Error ( 'ENOENT' ) ;
350350 ( error as any ) . code = 'ENOENT' ;
351351 mockFs . appendFile . mockRejectedValue ( error ) ;
352352 mockFs . writeFile . mockResolvedValue ( undefined ) ;
353353
354- await writeOrUpdateFileContent ( '/test/newfile.txt' , 'initial content' ) ;
354+ await createOrAppendFileContent ( '/test/newfile.txt' , 'initial content' ) ;
355355
356356 expect ( mockFs . writeFile ) . toHaveBeenCalledWith (
357357 '/test/newfile.txt' ,
@@ -363,7 +363,7 @@ describe('Lib Functions', () => {
363363 it ( 'appends to existing file' , async ( ) => {
364364 mockFs . appendFile . mockResolvedValue ( undefined ) ;
365365
366- await writeOrUpdateFileContent ( '/test/file.txt' , '\nappended content' ) ;
366+ await createOrAppendFileContent ( '/test/file.txt' , '\nappended content' ) ;
367367
368368 expect ( mockFs . appendFile ) . toHaveBeenCalledWith (
369369 '/test/file.txt' ,
@@ -385,7 +385,7 @@ describe('Lib Functions', () => {
385385 . mockResolvedValueOnce ( undefined ) ;
386386 mockFs . rename . mockResolvedValue ( undefined ) ;
387387
388- await writeOrUpdateFileContent ( '/test/file.txt' , 'content' ) ;
388+ await createOrAppendFileContent ( '/test/file.txt' , 'content' ) ;
389389
390390 expect ( mockFs . writeFile ) . toHaveBeenCalledTimes ( 2 ) ;
391391 expect ( mockFs . rename ) . toHaveBeenCalled ( ) ;
@@ -396,7 +396,7 @@ describe('Lib Functions', () => {
396396 ( error as any ) . code = 'EACCES' ;
397397 mockFs . appendFile . mockRejectedValue ( error ) ;
398398
399- await expect ( writeOrUpdateFileContent ( '/test/file.txt' , 'content' ) )
399+ await expect ( createOrAppendFileContent ( '/test/file.txt' , 'content' ) )
400400 . rejects . toThrow ( 'Permission denied' ) ;
401401 } ) ;
402402 } ) ;
0 commit comments