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', () => {