diff options
| author | uttamkanodia14 <[email protected]> | 2025-07-10 00:19:30 +0530 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-07-09 18:49:30 +0000 |
| commit | 063481faa4b1c86868689580ff0fbd8cb04141e3 (patch) | |
| tree | f7b38f46a95cd22bbf15a7454963ba834e15d134 /packages/cli/src/ui/hooks/useGeminiStream.test.tsx | |
| parent | 6c12f9e0d902c60fa5e01422018ce773c405da8d (diff) | |
Adding TurnId to Tool call and API responses and error logs. (#3039)
Co-authored-by: Scott Densmore <[email protected]>
Diffstat (limited to 'packages/cli/src/ui/hooks/useGeminiStream.test.tsx')
| -rw-r--r-- | packages/cli/src/ui/hooks/useGeminiStream.test.tsx | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/packages/cli/src/ui/hooks/useGeminiStream.test.tsx b/packages/cli/src/ui/hooks/useGeminiStream.test.tsx index 62ade50f..e0e21f55 100644 --- a/packages/cli/src/ui/hooks/useGeminiStream.test.tsx +++ b/packages/cli/src/ui/hooks/useGeminiStream.test.tsx @@ -109,12 +109,13 @@ vi.mock('./useLogger.js', () => ({ }), })); -const mockStartNewTurn = vi.fn(); +const mockStartNewPrompt = vi.fn(); const mockAddUsage = vi.fn(); vi.mock('../contexts/SessionContext.js', () => ({ useSessionStats: vi.fn(() => ({ - startNewTurn: mockStartNewTurn, + startNewPrompt: mockStartNewPrompt, addUsage: mockAddUsage, + getPromptCount: vi.fn(() => 5), })), })); @@ -301,6 +302,9 @@ describe('useGeminiStream', () => { getUsageStatisticsEnabled: () => true, getDebugMode: () => false, addHistory: vi.fn(), + getSessionId() { + return 'test-session-id'; + }, setQuotaErrorOccurred: vi.fn(), getQuotaErrorOccurred: vi.fn(() => false), } as unknown as Config; @@ -426,6 +430,7 @@ describe('useGeminiStream', () => { name: 'tool1', args: {}, isClientInitiated: false, + prompt_id: 'prompt-id-1', }, status: 'success', responseSubmittedToGemini: false, @@ -444,7 +449,12 @@ describe('useGeminiStream', () => { endTime: Date.now(), } as TrackedCompletedToolCall, { - request: { callId: 'call2', name: 'tool2', args: {} }, + request: { + callId: 'call2', + name: 'tool2', + args: {}, + prompt_id: 'prompt-id-1', + }, status: 'executing', responseSubmittedToGemini: false, tool: { @@ -481,6 +491,7 @@ describe('useGeminiStream', () => { name: 'tool1', args: {}, isClientInitiated: false, + prompt_id: 'prompt-id-2', }, status: 'success', responseSubmittedToGemini: false, @@ -492,6 +503,7 @@ describe('useGeminiStream', () => { name: 'tool2', args: {}, isClientInitiated: false, + prompt_id: 'prompt-id-2', }, status: 'error', responseSubmittedToGemini: false, @@ -546,6 +558,7 @@ describe('useGeminiStream', () => { expect(mockSendMessageStream).toHaveBeenCalledWith( expectedMergedResponse, expect.any(AbortSignal), + 'prompt-id-2', ); }); @@ -557,6 +570,7 @@ describe('useGeminiStream', () => { name: 'testTool', args: {}, isClientInitiated: false, + prompt_id: 'prompt-id-3', }, status: 'cancelled', response: { callId: '1', responseParts: [{ text: 'cancelled' }] }, @@ -618,6 +632,7 @@ describe('useGeminiStream', () => { name: 'toolA', args: {}, isClientInitiated: false, + prompt_id: 'prompt-id-7', }, tool: { name: 'toolA', @@ -641,6 +656,7 @@ describe('useGeminiStream', () => { name: 'toolB', args: {}, isClientInitiated: false, + prompt_id: 'prompt-id-8', }, tool: { name: 'toolB', @@ -731,6 +747,7 @@ describe('useGeminiStream', () => { name: 'tool1', args: {}, isClientInitiated: false, + prompt_id: 'prompt-id-4', }, status: 'executing', responseSubmittedToGemini: false, @@ -824,6 +841,7 @@ describe('useGeminiStream', () => { expect(mockSendMessageStream).toHaveBeenCalledWith( toolCallResponseParts, expect.any(AbortSignal), + 'prompt-id-4', ); }); @@ -1036,6 +1054,7 @@ describe('useGeminiStream', () => { name: 'save_memory', args: { fact: 'test' }, isClientInitiated: true, + prompt_id: 'prompt-id-6', }, status: 'success', responseSubmittedToGemini: false, |
