From 6b2707e24af1428968ee29f58feb58132224fe23 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 26 Feb 2026 15:01:56 +0000 Subject: [PATCH] fix(stdlib): improve cancellablePromise test to actually verify then callback is not called Co-authored-by: robonen <26167508+robonen@users.noreply.github.com> --- .../src/async/cancellablePromise/index.test.ts | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/core/stdlib/src/async/cancellablePromise/index.test.ts b/core/stdlib/src/async/cancellablePromise/index.test.ts index e87788a..c780f5a 100644 --- a/core/stdlib/src/async/cancellablePromise/index.test.ts +++ b/core/stdlib/src/async/cancellablePromise/index.test.ts @@ -37,23 +37,20 @@ describe('cancellablePromise', () => { await expect(promise).rejects.toThrow('Request aborted'); }); - it('cancel prevents onSuccess from being called', async () => { - const onSuccess = vi.fn(); + it('cancel prevents then callback from being called', async () => { + const onFulfilled = vi.fn(); const { promise, cancel } = cancellablePromise( new Promise((resolve) => setTimeout(() => resolve('data'), 100)), ); + const chained = promise.then(onFulfilled).catch(() => {}); + cancel(); - try { - await promise; - } - catch { - // expected - } + await chained; - expect(onSuccess).not.toHaveBeenCalled(); + expect(onFulfilled).not.toHaveBeenCalled(); }); it('CancelledError has correct name property', () => {