test(coding-agent): update stale expectations
This commit is contained in:
@@ -438,6 +438,7 @@ describe("AgentSession concurrent prompt guard", () => {
|
||||
_extensionRunner?: {
|
||||
hasHandlers: (eventType: string) => boolean;
|
||||
emit: (event: { type: string; message?: { role?: string } }) => Promise<void>;
|
||||
emitMessageEnd: (event: { type: string; message?: { role?: string } }) => Promise<undefined>;
|
||||
emitToolCall: (event: { type: string; toolCallId: string }) => Promise<undefined>;
|
||||
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<void>;
|
||||
emitMessageEnd: (event: { type: string; message?: { role?: string } }) => Promise<undefined>;
|
||||
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,
|
||||
|
||||
@@ -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.` });
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user