Fixes #97: SQLite is now async, optimized, tests

This commit is contained in:
Zef Hemel
2022-10-21 10:00:43 +02:00
parent b9da9b7965
commit c1a78e0105
65 changed files with 329 additions and 142 deletions
+16
View File
@@ -0,0 +1,16 @@
import { AsyncSQLite } from "./async_sqlite.ts";
import { assertEquals } from "../../test_deps.ts";
Deno.test("Async SQLite test", async () => {
const db = new AsyncSQLite(":memory:");
await db.init();
await db.execute("CREATE TABLE test (name TEXT)");
await db.execute("INSERT INTO test (name) VALUES (?)", "test");
await db.execute("INSERT INTO test (name) VALUES (?)", "test 2");
assertEquals(await db.query("SELECT * FROM test ORDER BY name"), [{
name: "test",
}, {
name: "test 2",
}]);
db.stop();
});