1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 17:38:12 +00:00

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

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);
});