Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions integration-tests/tests/async.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,17 @@ test.serial("Database.exec() after close()", async (t) => {
});
});

test.serial("Database.sync() after close()", async (t) => {
const db = t.context.db;
db.close();
await t.throwsAsync(async () => {
await db.sync();
}, {
instanceOf: TypeError,
message: "The database connection is not open"
});
});

test.serial("Database.interrupt()", async (t) => {
const db = t.context.db;
const stmt = await db.prepare("WITH RECURSIVE infinite_loop(n) AS (SELECT 1 UNION ALL SELECT n + 1 FROM infinite_loop) SELECT * FROM infinite_loop;");
Expand Down
4 changes: 2 additions & 2 deletions promise.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ class Database {
});
}

sync() {
async sync() {
try {
return this.db.sync();
return await this.db.sync();
} catch (err) {
throw convertError(err);
}
Expand Down