Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

test(test): update mock implementations for chat service functions

Steven Enamakelcadfaac00689
diff --git a/app/src/lib/attachments.roundtrip.test.ts b/app/src/lib/attachments.roundtrip.test.ts
index 33ee8ab6d9..f15c90ad1b 100644
--- a/app/src/lib/attachments.roundtrip.test.ts
+++ b/app/src/lib/attachments.roundtrip.test.ts
@@ -70,7 +70,12 @@ describe('image attachment round trip (composer -> wire -> durable reference)',
expect(JSON.stringify(appendCall.params)).not.toMatch(/\[(IMAGE|FILE):/);
// The turn is started with the durable content the core returned.
- mockCallCoreRpc.mockResolvedValueOnce({});
+ mockCallCoreRpc.mockResolvedValueOnce({
+ accepted: true,
+ client_id: 'sock-1',
+ thread_id: 't1',
+ request_id: 'request-1',
+ });
await chatSend({ threadId: 't1', message: saved.content });
expect(mockCallCoreRpc.mock.calls[1][0].params.message).toBe(`look ${DURABLE}`);
diff --git a/app/src/pages/__tests__/Conversations.render.test.tsx b/app/src/pages/__tests__/Conversations.render.test.tsx
index 502947b719..e557031119 100644
--- a/app/src/pages/__tests__/Conversations.render.test.tsx
+++ b/app/src/pages/__tests__/Conversations.render.test.tsx
@@ -16,7 +16,7 @@ import { beforeEach, describe, expect, it, vi } from 'vitest';
import { SidebarSlotOutlet, SidebarSlotProvider } from '../../components/layout/shell/SidebarSlot';
import { threadApi } from '../../services/api/threadApi';
-import { chatCancel, chatRemoveQueueItem, chatSend } from '../../services/chatService';
+import { chatCancel, chatRemoveQueueItem, chatSend, chatSendWithAck } from '../../services/chatService';
import { CoreRpcError } from '../../services/coreRpcClient';
import chatRuntimeReducer, {
beginInferenceTurn,
@@ -78,6 +78,7 @@ vi.mock('../../services/chatService', () => ({
chatClearQueue: vi.fn().mockResolvedValue(0),
chatRemoveQueueItem: vi.fn().mockResolvedValue(true),
chatSend: vi.fn().mockResolvedValue(undefined),
+ chatSendWithAck: vi.fn().mockResolvedValue({ requestId: 'request-test', queuedAttachments: [] }),
subscribeChatEvents: vi.fn(() => () => {}),
useRustChat: vi.fn(() => true),
}));
@@ -961,7 +962,8 @@ describe('Conversations — smoke render (#1123 welcome-lock removal)', () => {
await waitFor(() => {
expect(threadApi.appendMessage).toHaveBeenCalledWith(
thread.id,
- expect.objectContaining({ content: 'hello cloud', sender: 'user', type: 'text' })
+ expect.objectContaining({ content: 'hello cloud', sender: 'user', type: 'text' }),
+ []
);
});
expect(chatSend).toHaveBeenCalledWith(
@@ -2554,7 +2556,7 @@ describe('Conversations — queued follow-ups while a turn streams', () => {
});
await waitFor(() => {
- expect(chatSend).toHaveBeenCalledWith(expect.objectContaining({ queueMode: 'followup' }));
+ expect(chatSendWithAck).toHaveBeenCalledWith(expect.objectContaining({ queueMode: 'followup' }));
});
await waitFor(() =>
expect(
@@ -2577,7 +2579,7 @@ describe('Conversations — queued follow-ups while a turn streams', () => {
});
await waitFor(() => {
- expect(chatSend).toHaveBeenCalledWith(expect.objectContaining({ queueMode: 'followup' }));
+ expect(chatSendWithAck).toHaveBeenCalledWith(expect.objectContaining({ queueMode: 'followup' }));
});
});
@@ -2626,7 +2628,7 @@ describe('Conversations — queued follow-ups while a turn streams', () => {
});
it('keeps the draft intact when the follow-up send fails', async () => {
- vi.mocked(chatSend).mockRejectedValueOnce(new Error('send boom'));
+ vi.mocked(chatSendWithAck).mockRejectedValueOnce(new Error('send boom'));
const { store, textarea } = await renderStreamingConversation();
await act(async () => {
@@ -2638,7 +2640,7 @@ describe('Conversations — queued follow-ups while a turn streams', () => {
// Send rejected → nothing recorded for the transcript, and the composer
// keeps the user's text so they can retry instead of silently losing it.
- await waitFor(() => expect(chatSend).toHaveBeenCalled());
+ await waitFor(() => expect(chatSendWithAck).toHaveBeenCalled());
expect(store?.getState().queue.pendingFollowupsByThread['fup-thread']).toBeUndefined();
expect(textarea).toHaveTextContent('keep me on failure');
});