From 9cdcb2fd7c1c1878d4abfa1efd8a503a814edbbc Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Mon, 21 Feb 2022 16:58:29 -0500 Subject: [PATCH] Fix DB timeout test after 078e3bb079 --- test/tests/dbTest.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/test/tests/dbTest.js b/test/tests/dbTest.js index 21516a65c1..8339e3972e 100644 --- a/test/tests/dbTest.js +++ b/test/tests/dbTest.js @@ -309,11 +309,18 @@ describe("Zotero.DB", function() { yield Zotero.DB.queryAsync("DROP TABLE " + tmpTable); }); - it("should time out on nested transactions", function* () { + it("should time out on nested transactions", async function () { var e; - yield Zotero.DB.executeTransaction(function* () { - e = yield getPromiseError( - Zotero.DB.executeTransaction(function* () {}).timeout(250) + await Zotero.DB.executeTransaction(async function () { + e = await getPromiseError( + Promise.race([ + Zotero.Promise.delay(250).then(() => { + var e = new Error; + e.name = "TimeoutError"; + throw e; + }), + Zotero.DB.executeTransaction(async function () {}) + ]) ); }); assert.ok(e);