test: tighten slack and openshell assertions · openclaw/openclaw@38295d3
shakkernerd
·
2026-05-11
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -200,6 +200,17 @@ async function makeTempDir(prefix: string) {
|
200 | 200 | return dir; |
201 | 201 | } |
202 | 202 | |
| 203 | +async function expectPathMissing(targetPath: string): Promise<void> { |
| 204 | +let error: unknown; |
| 205 | +try { |
| 206 | +await fs.stat(targetPath); |
| 207 | +} catch (caught) { |
| 208 | +error = caught; |
| 209 | +} |
| 210 | +expect(error).toBeInstanceOf(Error); |
| 211 | +expect((error as NodeJS.ErrnoException).code).toBe("ENOENT"); |
| 212 | +} |
| 213 | + |
203 | 214 | afterEach(async () => { |
204 | 215 | await Promise.all(tempDirs.splice(0).map((dir) => fs.rm(dir, { recursive: true, force: true }))); |
205 | 216 | }); |
@@ -276,9 +287,7 @@ describe("openshell fs bridges", () => {
|
276 | 287 | mkdir: true, |
277 | 288 | }), |
278 | 289 | ).rejects.toThrow("Sandbox path escapes allowed mounts"); |
279 | | -await expect(fs.stat(path.join(outsideDir, "escape.txt"))).rejects.toMatchObject({ |
280 | | -code: "ENOENT", |
281 | | -}); |
| 290 | +await expectPathMissing(path.join(outsideDir, "escape.txt")); |
282 | 291 | await expect(fs.readdir(outsideDir)).resolves.toStrictEqual([]); |
283 | 292 | expect(backend.syncLocalPathToRemote).not.toHaveBeenCalled(); |
284 | 293 | }); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。