@@ -224,12 +224,17 @@ describe("poe-agent-plugin-files", () => {
224224 const originalContent = "export const value = 'old';\n" ;
225225 const nextContent = "export const value = 'new';\n" ;
226226 const base = createFsFromVolume ( Volume . fromJSON ( { [ filePath ] : originalContent } , "/" ) ) . promises ;
227+ let temporaryPath : string | undefined ;
227228 const fs = {
228229 ...base ,
229230 async writeFile ( targetPath : string , data : Parameters < typeof base . writeFile > [ 1 ] , options ?: Parameters < typeof base . writeFile > [ 2 ] ) {
230231 if ( String ( data ) === nextContent ) {
231- if ( targetPath === filePath ) {
232- await base . writeFile ( targetPath , "partial" , "utf8" ) ;
232+ if (
233+ targetPath . startsWith ( "/workspace/project/src/.app.ts." ) &&
234+ targetPath . endsWith ( ".tmp" )
235+ ) {
236+ temporaryPath = targetPath ;
237+ await base . writeFile ( targetPath , "partial" , options ) ;
233238 }
234239 throw new Error ( "write failed" ) ;
235240 }
@@ -247,6 +252,10 @@ describe("poe-agent-plugin-files", () => {
247252 } )
248253 ) . rejects . toThrow ( "write failed" ) ;
249254 await expect ( base . readFile ( filePath , "utf8" ) ) . resolves . toBe ( originalContent ) ;
255+ expect ( temporaryPath ) . toBeDefined ( ) ;
256+ await expect ( base . readFile ( temporaryPath ?? "" , "utf8" ) ) . rejects . toMatchObject ( {
257+ code : "ENOENT"
258+ } ) ;
250259 } ) ;
251260
252261 it ( "does not remove a colliding atomic edit temp symlink" , async ( ) => {
0 commit comments