test: tighten replace file rejection assertion · openclaw/openclaw@10caa52
shakkernerd
·
2026-05-11
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -26,7 +26,16 @@ describe("movePathWithCopyFallback", () => {
|
26 | 26 | ).rejects.toThrow("Hardlinked source file is not allowed"); |
27 | 27 | |
28 | 28 | await expect(fs.readFile(sourceFile, "utf8")).resolves.toBe("hello"); |
29 | | -await expect(fs.stat(targetDir)).rejects.toMatchObject({ code: "ENOENT" }); |
| 29 | +let statError: NodeJS.ErrnoException | undefined; |
| 30 | +try { |
| 31 | +await fs.stat(targetDir); |
| 32 | +} catch (error) { |
| 33 | +statError = error as NodeJS.ErrnoException; |
| 34 | +} |
| 35 | +expect(statError).toBeInstanceOf(Error); |
| 36 | +expect(statError?.code).toBe("ENOENT"); |
| 37 | +expect(statError?.path).toBe(targetDir); |
| 38 | +expect(statError?.syscall).toBe("stat"); |
30 | 39 | }); |
31 | 40 | }, |
32 | 41 | ); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。