bindings/javascript: Add better-sqlite3 tests

This commit is contained in:
Pekka Enberg
2025-03-28 10:44:05 +02:00
parent 11d1dcf31a
commit 7348eb0aa1
4 changed files with 720 additions and 68 deletions

View File

@@ -0,0 +1,20 @@
import test from "ava";
import Database from "better-sqlite3";
test("Open in-memory database", async (t) => {
const [db] = await connect(":memory:");
t.is(db.memory, true);
});
test("Statement.get()", async (t) => {
const [db] = await connect(":memory:");
const stmt = db.prepare("SELECT 1");
const result = stmt.get();
t.is(result["1"], 1);
});
const connect = async (path) => {
const db = new Database(path);
return [db];
};

View File

@@ -18,7 +18,8 @@
"license": "MIT",
"devDependencies": {
"@napi-rs/cli": "^2.18.4",
"ava": "^6.0.1"
"ava": "^6.0.1",
"better-sqlite3": "^11.9.1"
},
"ava": {
"timeout": "3m"

File diff suppressed because it is too large Load Diff