LibJS/Tests: Add a test for an async function which returns a thenable

This test passes when running in the AST interpreter, but fails when
running for bytecode.
This commit is contained in:
Shannon Booth 2023-07-17 23:16:28 +12:00 committed by Linus Groh
parent eb1f61f3b1
commit 016b31fae2
Notes: sideshowbarker 2024-07-17 11:34:34 +09:00

View file

@ -200,3 +200,15 @@ describe("await cannot be used in class static init blocks", () => {
expect("class A{ static { async function* await() {} } }").not.toEval();
});
});
test("async returning a thenable", () => {
let isCalled = false;
const f = async () => ({
then() {
isCalled = true;
},
});
f();
runQueuedPromiseJobs();
expect(isCalled).toBe(true);
});