mirror of
https://github.com/aljazceru/turso.git
synced 2026-01-08 18:54:21 +01:00
bindings/javascript: Add better-sqlite3 tests
This commit is contained in:
20
bindings/javascript/__test__/better-sqlite3.spec.mjs
Normal file
20
bindings/javascript/__test__/better-sqlite3.spec.mjs
Normal 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];
|
||||
};
|
||||
@@ -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
Reference in New Issue
Block a user