test: check auto-reply missing files

This commit is contained in:
Shakker
2026-05-11 17:54:17 +01:00
parent 177ff5baba
commit d9491a8a98
2 changed files with 21 additions and 16 deletions

View File

@@ -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);
});

View File

@@ -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", () => {