Skip to content

Commit 8ad3bcf

Browse files
committed
assert unhandled rejection behaviour, microsoft#56137
1 parent 12ae0f6 commit 8ad3bcf

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

src/vs/base/test/common/async.test.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,17 @@ suite('Async', () => {
4141
return result;
4242
});
4343

44+
test('Cancel callback behaviour', async function () {
45+
let withCancelCallback = new TPromise(() => { }, () => { });
46+
let withoutCancelCallback = new TPromise(() => { });
47+
48+
withCancelCallback.cancel();
49+
withoutCancelCallback.cancel();
50+
51+
await withCancelCallback.then(undefined, err => { assert.ok(isPromiseCanceledError(err)); });
52+
await withoutCancelCallback.then(undefined, err => { assert.ok(isPromiseCanceledError(err)); });
53+
});
54+
4455
// Cancelling a sync cancelable promise will fire the cancelled token.
4556
// Also, every `then` callback runs in another execution frame.
4657
test('CancelablePromise execution order (sync)', function () {

0 commit comments

Comments
 (0)