






















@@ -130,20 +130,15 @@ describe("pw-tools-core", () => {
130130async function expectAtomicDownloadSave(params: {
131131saveAs: ReturnType<typeof vi.fn>;
132132targetPath: string;
133-tempDir: string;
134133content: string;
135134}) {
136135const savedPath = params.saveAs.mock.calls[0]?.[0];
137136expect(typeof savedPath).toBe("string");
138137expect(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);
144138expect(path.basename(String(savedPath))).toContain(".openclaw-output-");
145139expect(path.basename(String(savedPath))).toContain(".part");
146140expect(await fs.readFile(params.targetPath, "utf8")).toBe(params.content);
141+await expect(fs.access(String(savedPath))).rejects.toThrow();
147142}
148143149144it("waits for the next download and atomically finalizes explicit output paths", async () => {
@@ -172,7 +167,7 @@ describe("pw-tools-core", () => {
172167harness.trigger(download);
173168174169const res = await p;
175-await expectAtomicDownloadSave({ saveAs, targetPath, tempDir, content: "file-content" });
170+await expectAtomicDownloadSave({ saveAs, targetPath, content: "file-content" });
176171await expect(fs.realpath(res.path)).resolves.toBe(await fs.realpath(targetPath));
177172});
178173});
@@ -233,7 +228,7 @@ describe("pw-tools-core", () => {
233228harness.trigger(download);
234229235230const res = await p;
236-await expectAtomicDownloadSave({ saveAs, targetPath, tempDir, content: "report-content" });
231+await expectAtomicDownloadSave({ saveAs, targetPath, content: "report-content" });
237232await expect(fs.realpath(res.path)).resolves.toBe(await fs.realpath(targetPath));
238233});
239234});
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。