@@ -130,20 +130,15 @@ describe("pw-tools-core", () => {
130130 async function expectAtomicDownloadSave ( params : {
131131 saveAs : ReturnType < typeof vi . fn > ;
132132 targetPath : string ;
133- tempDir : string ;
134133 content : string ;
135134 } ) {
136135 const savedPath = params . saveAs . mock . calls [ 0 ] ?. [ 0 ] ;
137136 expect ( typeof savedPath ) . toBe ( "string" ) ;
138137 expect ( savedPath ) . not . toBe ( params . targetPath ) ;
139- const [ savedDirReal , tempDirReal ] = await Promise . all ( [
140- fs . realpath ( path . dirname ( String ( savedPath ) ) ) . catch ( ( ) => path . dirname ( String ( savedPath ) ) ) ,
141- fs . realpath ( params . tempDir ) . catch ( ( ) => params . tempDir ) ,
142- ] ) ;
143- expect ( savedDirReal ) . toBe ( tempDirReal ) ;
144138 expect ( path . basename ( String ( savedPath ) ) ) . toContain ( ".openclaw-output-" ) ;
145139 expect ( path . basename ( String ( savedPath ) ) ) . toContain ( ".part" ) ;
146140 expect ( await fs . readFile ( params . targetPath , "utf8" ) ) . toBe ( params . content ) ;
141+ await expect ( fs . access ( String ( savedPath ) ) ) . rejects . toThrow ( ) ;
147142 }
148143
149144 it ( "waits for the next download and atomically finalizes explicit output paths" , async ( ) => {
@@ -172,7 +167,7 @@ describe("pw-tools-core", () => {
172167 harness . trigger ( download ) ;
173168
174169 const res = await p ;
175- await expectAtomicDownloadSave ( { saveAs, targetPath, tempDir , content : "file-content" } ) ;
170+ await expectAtomicDownloadSave ( { saveAs, targetPath, content : "file-content" } ) ;
176171 await expect ( fs . realpath ( res . path ) ) . resolves . toBe ( await fs . realpath ( targetPath ) ) ;
177172 } ) ;
178173 } ) ;
@@ -233,7 +228,7 @@ describe("pw-tools-core", () => {
233228 harness . trigger ( download ) ;
234229
235230 const res = await p ;
236- await expectAtomicDownloadSave ( { saveAs, targetPath, tempDir , content : "report-content" } ) ;
231+ await expectAtomicDownloadSave ( { saveAs, targetPath, content : "report-content" } ) ;
237232 await expect ( fs . realpath ( res . path ) ) . resolves . toBe ( await fs . realpath ( targetPath ) ) ;
238233 } ) ;
239234 } ) ;
0 commit comments