Skip to content

graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs

Python

Keep attachment replacement coverage focused

yxlyx6ca663d4b65a
diff --git a/gui/src/app/sessionStore.test.ts b/gui/src/app/sessionStore.test.ts
index a6c1e68f..1a79e0ff 100644
--- a/gui/src/app/sessionStore.test.ts
+++ b/gui/src/app/sessionStore.test.ts
@@ -112,7 +112,6 @@ mock.module("../services/desktop/client", () => ({
},
savePastedImage: async () => "/tmp/pasted-image.png",
imageThumbnail: async () => "data:image/jpeg;base64,",
- listCommands: async () => [],
openExternalUrl: async () => {},
openPathInTarget: async () => {},
ensureConversationView: async (workspacePath: string, conversationId: string) => {
@@ -397,43 +396,6 @@ describe("sessionStore", () => {
).toBeUndefined();
});
- test("attachment replacement removes the previous history entry atomically", () => {
- const key = "conversation:history-attachments";
- const previous = {
- id: "/abs/previous.png",
- path: "/abs/previous.png",
- name: "previous.png",
- ext: "png",
- kind: "image" as const,
- };
- const next = [
- {
- id: "/abs/next-a.png",
- path: "/abs/next-a.png",
- name: "next-a.png",
- ext: "png",
- kind: "image" as const,
- },
- {
- id: "/abs/next-b.png",
- path: "/abs/next-b.png",
- name: "next-b.png",
- ext: "png",
- kind: "image" as const,
- },
- ];
-
- sessionStore.getState().addAttachments(key, [previous]);
- sessionStore.getState().replaceAttachments(key, next);
-
- expect(getAttachments(key)).toEqual(next);
- expect(getAttachments(key)).not.toContainEqual(previous);
-
- sessionStore.getState().replaceAttachments(key, []);
- expect(getAttachments(key)).toEqual([]);
- expect(sessionStore.getState().attachmentsByKey[key]).toBeUndefined();
- });
-
test("workspace draft selection ignores a stale active conversation", () => {
sessionStore.getState().applySessionSnapshot(createSnapshot());
sessionStore.getState().setBoardSelection({
diff --git a/gui/src/app/sessionStoreAttachments.test.ts b/gui/src/app/sessionStoreAttachments.test.ts
new file mode 100644
index 00000000..cf624fee
--- /dev/null
+++ b/gui/src/app/sessionStoreAttachments.test.ts
@@ -0,0 +1,42 @@
+import { afterEach, expect, test } from "bun:test";
+
+import { getAttachments, resetSessionStore, sessionStore } from "./sessionStore";
+
+afterEach(resetSessionStore);
+
+test("attachment replacement removes the previous history entry atomically", () => {
+ const key = "conversation:history-attachments";
+ const previous = {
+ id: "/abs/previous.png",
+ path: "/abs/previous.png",
+ name: "previous.png",
+ ext: "png",
+ kind: "image" as const,
+ };
+ const next = [
+ {
+ id: "/abs/next-a.png",
+ path: "/abs/next-a.png",
+ name: "next-a.png",
+ ext: "png",
+ kind: "image" as const,
+ },
+ {
+ id: "/abs/next-b.png",
+ path: "/abs/next-b.png",
+ name: "next-b.png",
+ ext: "png",
+ kind: "image" as const,
+ },
+ ];
+
+ sessionStore.getState().addAttachments(key, [previous]);
+ sessionStore.getState().replaceAttachments(key, next);
+
+ expect(getAttachments(key)).toEqual(next);
+ expect(getAttachments(key)).not.toContainEqual(previous);
+
+ sessionStore.getState().replaceAttachments(key, []);
+ expect(getAttachments(key)).toEqual([]);
+ expect(sessionStore.getState().attachmentsByKey[key]).toBeUndefined();
+});