diff --git a/src/auto-reply/reply.triggers.trigger-handling.stages-inbound-media-into-sandbox-workspace.test.ts b/src/auto-reply/reply.triggers.trigger-handling.stages-inbound-media-into-sandbox-workspace.test.ts index 6d1f0338a79..a975e7c11ae 100644 --- a/src/auto-reply/reply.triggers.trigger-handling.stages-inbound-media-into-sandbox-workspace.test.ts +++ b/src/auto-reply/reply.triggers.trigger-handling.stages-inbound-media-into-sandbox-workspace.test.ts @@ -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); }); diff --git a/src/auto-reply/reply/agent-runner-session-reset.test.ts b/src/auto-reply/reply/agent-runner-session-reset.test.ts index 7847b4565fd..edec3a80981 100644 --- a/src/auto-reply/reply/agent-runner-session-reset.test.ts +++ b/src/auto-reply/reply/agent-runner-session-reset.test.ts @@ -13,10 +13,13 @@ const refreshQueuedFollowupSessionMock = vi.fn(); const errorMock = vi.fn(); async function expectPathMissing(targetPath: string): Promise { - 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", () => {