-
Notifications
You must be signed in to change notification settings - Fork 25
Closed
Description
I have this test which uses async/await but it does not appear to cancel the promise
it('promiseChain partial', async () => {
let f = 0;
const cp = cancelable(
(async () => {
await new Promise((r) => setTimeout(() => r(), 100));
f = 1;
await new Promise((r) => setTimeout(() => r(), 100));
f = 2;
await new Promise((r) => setTimeout(() => r(), 100));
f = 3;
await new Promise((r) => setTimeout(() => r(), 100));
f = 4;
expect(true).toBe(false);
})()
);
await new Promise((r) => setTimeout(() => r(), 250));
cp.cancel();
expect(f).toBe(2);
});Metadata
Metadata
Assignees
Labels
No labels