mirror of
https://github.com/tursodatabase/limbo.git
synced 2025-07-24 12:53:45 +00:00
20 lines
465 B
JavaScript
20 lines
465 B
JavaScript
import test from "ava";
|
|
|
|
import { Database } from "../index.js";
|
|
|
|
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];
|
|
};
|