test(core): fix async timer handling in GeminiChat tests

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
yiliang114 2026-03-03 21:01:24 +08:00
parent 282a3b43a0
commit 81caadcf3a

View file

@ -145,7 +145,7 @@ describe('GeminiChat', async () => {
/* consume */
}
})();
// Register rejection handler BEFORE advancing timers to avoid unhandled rejection.
// Get assertion promise first (don't await), then advance timers to avoid deadlock.
const resultPromise =
await expect(collecting).rejects.toThrow(InvalidStreamError);
await vi.advanceTimersByTimeAsync(35_000);