summaryrefslogtreecommitdiff
path: root/packages/cli/src/ui/hooks/useGeminiStream.test.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'packages/cli/src/ui/hooks/useGeminiStream.test.tsx')
-rw-r--r--packages/cli/src/ui/hooks/useGeminiStream.test.tsx72
1 files changed, 0 insertions, 72 deletions
diff --git a/packages/cli/src/ui/hooks/useGeminiStream.test.tsx b/packages/cli/src/ui/hooks/useGeminiStream.test.tsx
index 0c8b261e..9751f470 100644
--- a/packages/cli/src/ui/hooks/useGeminiStream.test.tsx
+++ b/packages/cli/src/ui/hooks/useGeminiStream.test.tsx
@@ -604,78 +604,6 @@ describe('useGeminiStream', () => {
});
});
- describe('Session Stats Integration', () => {
- it('should call startNewTurn and addUsage for a simple prompt', async () => {
- const mockMetadata = { totalTokenCount: 123 };
- const mockStream = (async function* () {
- yield { type: 'content', value: 'Response' };
- yield { type: 'usage_metadata', value: mockMetadata };
- })();
- mockSendMessageStream.mockReturnValue(mockStream);
-
- const { result } = renderTestHook();
-
- await act(async () => {
- await result.current.submitQuery('Hello, world!');
- });
-
- expect(mockStartNewTurn).toHaveBeenCalledTimes(1);
- expect(mockAddUsage).toHaveBeenCalledTimes(1);
- expect(mockAddUsage).toHaveBeenCalledWith(mockMetadata);
- });
-
- it('should only call addUsage for a tool continuation prompt', async () => {
- const mockMetadata = { totalTokenCount: 456 };
- const mockStream = (async function* () {
- yield { type: 'content', value: 'Final Answer' };
- yield { type: 'usage_metadata', value: mockMetadata };
- })();
- mockSendMessageStream.mockReturnValue(mockStream);
-
- const { result } = renderTestHook();
-
- await act(async () => {
- await result.current.submitQuery([{ text: 'tool response' }], {
- isContinuation: true,
- });
- });
-
- expect(mockStartNewTurn).not.toHaveBeenCalled();
- expect(mockAddUsage).toHaveBeenCalledTimes(1);
- expect(mockAddUsage).toHaveBeenCalledWith(mockMetadata);
- });
-
- it('should not call addUsage if the stream contains no usage metadata', async () => {
- // Arrange: A stream that yields content but never a usage_metadata event
- const mockStream = (async function* () {
- yield { type: 'content', value: 'Some response text' };
- })();
- mockSendMessageStream.mockReturnValue(mockStream);
-
- const { result } = renderTestHook();
-
- await act(async () => {
- await result.current.submitQuery('Query with no usage data');
- });
-
- expect(mockStartNewTurn).toHaveBeenCalledTimes(1);
- expect(mockAddUsage).not.toHaveBeenCalled();
- });
-
- it('should not call startNewTurn for a slash command', async () => {
- mockHandleSlashCommand.mockReturnValue(true);
-
- const { result } = renderTestHook();
-
- await act(async () => {
- await result.current.submitQuery('/stats');
- });
-
- expect(mockStartNewTurn).not.toHaveBeenCalled();
- expect(mockSendMessageStream).not.toHaveBeenCalled();
- });
- });
-
it('should not flicker streaming state to Idle between tool completion and submission', async () => {
const toolCallResponseParts: PartListUnion = [
{ text: 'tool 1 final response' },