Add tests

This commit is contained in:
Anton Harniakou 2025-06-05 08:21:59 +03:00
parent c00ebe94c0
commit 6f88505f90
2 changed files with 13 additions and 0 deletions

View file

@ -101,6 +101,12 @@ test("Test Statement.database gets the database object", async t => {
t.is(stmt.database, db);
});
test("Test Statement.source", async t => {
const [db] = await connect(":memory:");
let sql = "CREATE TABLE t (id int)";
let stmt = db.prepare(sql);
t.is(stmt.source, sql);
});
const connect = async (path) => {
const db = new Database(path);

View file

@ -161,6 +161,13 @@ test("Test Statement.database gets the database object", async t => {
t.is(stmt.database, db);
});
test("Test Statement.source", async t => {
const [db] = await connect(":memory:");
let sql = "CREATE TABLE t (id int)";
let stmt = db.prepare(sql);
t.is(stmt.source, sql);
});
const connect = async (path) => {
const db = new Database(path);
return [db];