mirror of
https://github.com/tursodatabase/limbo.git
synced 2025-08-04 10:08:20 +00:00
bindings/javascript: Fix Statement.get() implementation
This commit is contained in:
parent
7348eb0aa1
commit
94262e4660
3 changed files with 29 additions and 9 deletions
|
@ -7,11 +7,21 @@ test("Open in-memory database", async (t) => {
|
|||
t.is(db.memory, true);
|
||||
});
|
||||
|
||||
test("Statement.get()", async (t) => {
|
||||
|
||||
test("Statement.get() returns data", async (t) => {
|
||||
const [db] = await connect(":memory:");
|
||||
const stmt = db.prepare("SELECT 1");
|
||||
const result = stmt.get();
|
||||
t.is(result["1"], 1);
|
||||
const result2 = stmt.get();
|
||||
t.is(result2["1"], 1);
|
||||
});
|
||||
|
||||
test("Statement.get() returns null when no data", async (t) => {
|
||||
const [db] = await connect(":memory:");
|
||||
const stmt = db.prepare("SELECT 1 WHERE 1 = 2");
|
||||
const result = stmt.get();
|
||||
t.is(result, undefined);
|
||||
});
|
||||
|
||||
const connect = async (path) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue