From 016b31fae29fa290a9f421093a85b76edeaa99b4 Mon Sep 17 00:00:00 2001 From: Shannon Booth Date: Mon, 17 Jul 2023 23:16:28 +1200 Subject: [PATCH] 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. --- Userland/Libraries/LibJS/Tests/syntax/async-await.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Userland/Libraries/LibJS/Tests/syntax/async-await.js b/Userland/Libraries/LibJS/Tests/syntax/async-await.js index d86c9eea8e..d5d8b469f8 100644 --- a/Userland/Libraries/LibJS/Tests/syntax/async-await.js +++ b/Userland/Libraries/LibJS/Tests/syntax/async-await.js @@ -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); +});