From 1b9941fd3eaa42e6e1f08487737dc28b3f57cc3f Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Thu, 31 Jul 2025 07:38:40 -0700 Subject: [PATCH] Update streamResponse.test.ts --- gui/src/redux/thunks/streamResponse.test.ts | 58 +++++++++++++++++++-- 1 file changed, 55 insertions(+), 3 deletions(-) diff --git a/gui/src/redux/thunks/streamResponse.test.ts b/gui/src/redux/thunks/streamResponse.test.ts index fbd4b2726..36ea62171 100644 --- a/gui/src/redux/thunks/streamResponse.test.ts +++ b/gui/src/redux/thunks/streamResponse.test.ts @@ -1575,7 +1575,30 @@ describe("streamResponseThunk", () => { // Verify IDE messenger was called for compilation but not streaming expect(mockIdeMessenger.request).toHaveBeenCalledWith("llm/compileChat", { - messages: [{ role: "user", content: "Hello" }], + messages: [ + { + role: "system", + content: "You are a helpful assistant.", + }, + { + role: "user", + content: [ + { + text: "Hello", + type: "text", + }, + ], + }, + { + role: "user", + content: [ + { + text: "Hello, please help me with this code", + type: "text", + }, + ], + }, + ], options: {}, }); expect(mockIdeMessenger.llmStreamChat).not.toHaveBeenCalled(); @@ -1585,11 +1608,40 @@ describe("streamResponseThunk", () => { expect(finalState).toEqual({ session: { history: [ + { + contextItems: [], + message: { + content: "Hello", + id: "1", + role: "user", + }, + }, { appliedRules: [], + contextItems: [], + editorState: { + type: "doc", + content: [ + { + type: "paragraph", + content: [{ type: "text", text: "Hello, please help me with this code" }], + }, + ], + }, + message: { + content: "Hello, please help me with this code", + id: "mock-uuid-123", + role: "user", + }, + }, + { contextItems: [], isGatheringContext: false, - message: { id: "1", role: "user", content: "Hello" }, + message: { + content: "", + id: "mock-uuid-123", + role: "assistant", + }, }, ], hasReasoningEnabled: false, @@ -1600,7 +1652,7 @@ describe("streamResponseThunk", () => { contextPercentage: 0, // Unchanged - no successful compilation isPruned: false, // Unchanged - no successful compilation isInEdit: false, - title: "", + title: "New Session", lastSessionId: undefined, isSessionMetadataLoading: false, allSessionMetadata: [],