From bd429f7c7d563acc5dab00f362814ca1a21528bf Mon Sep 17 00:00:00 2001 From: Mario Zechner Date: Thu, 30 Apr 2026 23:17:32 +0200 Subject: [PATCH] test(coding-agent): update stale expectations --- .../coding-agent/test/agent-session-concurrent.test.ts | 7 ++++++- packages/coding-agent/test/tools.test.ts | 10 +++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/packages/coding-agent/test/agent-session-concurrent.test.ts b/packages/coding-agent/test/agent-session-concurrent.test.ts index 50536e8e..71916298 100644 --- a/packages/coding-agent/test/agent-session-concurrent.test.ts +++ b/packages/coding-agent/test/agent-session-concurrent.test.ts @@ -438,6 +438,7 @@ describe("AgentSession concurrent prompt guard", () => { _extensionRunner?: { hasHandlers: (eventType: string) => boolean; emit: (event: { type: string; message?: { role?: string } }) => Promise; + emitMessageEnd: (event: { type: string; message?: { role?: string } }) => Promise; emitToolCall: (event: { type: string; toolCallId: string }) => Promise; emitInput: ( text: string, @@ -456,6 +457,7 @@ describe("AgentSession concurrent prompt guard", () => { sessionWithRunner._extensionRunner = { hasHandlers: (eventType) => eventType === "tool_call", emit: async () => {}, + emitMessageEnd: async () => undefined, emitToolCall: async () => { snapshots.push( sessionManager @@ -581,6 +583,7 @@ describe("AgentSession concurrent prompt guard", () => { _extensionRunner?: { hasHandlers: (eventType: string) => boolean; emit: (event: { type: string; message?: { role?: string } }) => Promise; + emitMessageEnd: (event: { type: string; message?: { role?: string } }) => Promise; emitInput: ( text: string, images: unknown, @@ -597,10 +600,12 @@ describe("AgentSession concurrent prompt guard", () => { }; sessionWithRunner._extensionRunner = { hasHandlers: () => false, - emit: async (event) => { + emit: async () => {}, + emitMessageEnd: async (event) => { if (event.type === "message_end" && event.message?.role === "assistant") { await new Promise((resolve) => setTimeout(resolve, 40)); } + return undefined; }, emitInput: async () => ({ action: "continue" }), emitBeforeAgentStart: async () => undefined, diff --git a/packages/coding-agent/test/tools.test.ts b/packages/coding-agent/test/tools.test.ts index f93bb94f..df0c8f62 100644 --- a/packages/coding-agent/test/tools.test.ts +++ b/packages/coding-agent/test/tools.test.ts @@ -262,7 +262,7 @@ describe("Coding Agent Tools", () => { path: missingFile, edits: [{ oldText: "hello", newText: "world" }], }), - ).rejects.toThrow(`Could not write file: ${missingFile}. Error code: ENOENT.`); + ).rejects.toThrow(`Could not edit file: ${missingFile}. Error code: ENOENT.`); }); it("should fail if text appears multiple times", async () => { @@ -389,7 +389,7 @@ describe("Coding Agent Tools", () => { path: testFile, edits: [{ oldText: "hello", newText: "world" }], }), - ).rejects.toThrow(`Could not write file: ${testFile}. Error code: EACCES.`); + ).rejects.toThrow(`Could not edit file: ${testFile}. Error code: EACCES.`); }); it("should include the original error message for unknown edit access errors", async () => { @@ -408,14 +408,14 @@ describe("Coding Agent Tools", () => { path: "broken.txt", edits: [{ oldText: "hello", newText: "world" }], }), - ).rejects.toThrow("Could not write file: broken.txt. Error: disk offline."); + ).rejects.toThrow("Could not edit file: broken.txt. Error: disk offline."); }); it("should include ENOENT in diff preview for missing files", async () => { const missingFile = join(testDir, "missing-preview.txt"); const result = await computeEditsDiff(missingFile, [{ oldText: "hello", newText: "world" }], testDir); - expect(result).toEqual({ error: `Could not write file: ${missingFile}. Error code: ENOENT.` }); + expect(result).toEqual({ error: `Could not edit file: ${missingFile}. Error code: ENOENT.` }); }); it("should include EACCES in diff preview for unreadable files", async () => { @@ -425,7 +425,7 @@ describe("Coding Agent Tools", () => { const result = await computeEditsDiff(unreadableFile, [{ oldText: "hello", newText: "world" }], testDir); - expect(result).toEqual({ error: `Could not write file: ${unreadableFile}. Error code: EACCES.` }); + expect(result).toEqual({ error: `Could not edit file: ${unreadableFile}. Error code: EACCES.` }); }); });