mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-22 12:04:07 +00:00
test: check auto-reply missing files
This commit is contained in:
@@ -207,12 +207,13 @@ describe("stageSandboxMedia", () => {
|
||||
workspaceDir,
|
||||
});
|
||||
|
||||
await expect(
|
||||
fs.stat(join(sandboxDir, "media", "inbound", basename(sensitiveFile))),
|
||||
).rejects.toSatisfy((error) => {
|
||||
expect((error as NodeJS.ErrnoException).code).toBe("ENOENT");
|
||||
return true;
|
||||
});
|
||||
let stagedStatError: NodeJS.ErrnoException | undefined;
|
||||
try {
|
||||
await fs.stat(join(sandboxDir, "media", "inbound", basename(sensitiveFile)));
|
||||
} catch (error) {
|
||||
stagedStatError = error as NodeJS.ErrnoException;
|
||||
}
|
||||
expect(stagedStatError?.code).toBe("ENOENT");
|
||||
expect(ctx.MediaPath).toBe(sensitiveFile);
|
||||
}
|
||||
|
||||
@@ -289,12 +290,13 @@ describe("stageSandboxMedia", () => {
|
||||
workspaceDir,
|
||||
});
|
||||
|
||||
await expect(
|
||||
fs.stat(join(sandboxDir, "media", "inbound", basename(mediaPath))),
|
||||
).rejects.toSatisfy((error) => {
|
||||
expect((error as NodeJS.ErrnoException).code).toBe("ENOENT");
|
||||
return true;
|
||||
});
|
||||
let stagedStatError: NodeJS.ErrnoException | undefined;
|
||||
try {
|
||||
await fs.stat(join(sandboxDir, "media", "inbound", basename(mediaPath)));
|
||||
} catch (error) {
|
||||
stagedStatError = error as NodeJS.ErrnoException;
|
||||
}
|
||||
expect(stagedStatError?.code).toBe("ENOENT");
|
||||
expect(ctx.MediaPath).toBe(mediaPath);
|
||||
expect(sessionCtx.MediaPath).toBe(mediaPath);
|
||||
});
|
||||
|
||||
@@ -13,10 +13,13 @@ const refreshQueuedFollowupSessionMock = vi.fn();
|
||||
const errorMock = vi.fn();
|
||||
|
||||
async function expectPathMissing(targetPath: string): Promise<void> {
|
||||
await expect(fs.access(targetPath)).rejects.toSatisfy((error) => {
|
||||
expect((error as NodeJS.ErrnoException).code).toBe("ENOENT");
|
||||
return true;
|
||||
});
|
||||
let accessError: NodeJS.ErrnoException | undefined;
|
||||
try {
|
||||
await fs.access(targetPath);
|
||||
} catch (error) {
|
||||
accessError = error as NodeJS.ErrnoException;
|
||||
}
|
||||
expect(accessError?.code).toBe("ENOENT");
|
||||
}
|
||||
|
||||
describe("resetReplyRunSession", () => {
|
||||
|
||||
Reference in New Issue
Block a user