mirror of
https://github.com/tursodatabase/limbo.git
synced 2025-08-03 09:42:22 +00:00
Merge 'js-bindings/implement .name property' from Anton Harniakou
Returns the string that was used to open the database connection. Reviewed-by: Diego Reis (@el-yawd) Closes #1662
This commit is contained in:
commit
0e552e3f23
3 changed files with 29 additions and 0 deletions
|
@ -10,6 +10,18 @@ test("Open in-memory database", async (t) => {
|
|||
t.is(db.memory, true);
|
||||
});
|
||||
|
||||
test("Property .name of in-memory database", async (t) => {
|
||||
let name = ":memory:";
|
||||
const db = new Database(name);
|
||||
t.is(db.name,name);
|
||||
});
|
||||
|
||||
test("Property .name of database", async (t) => {
|
||||
let name = "foobar.db";
|
||||
const db = new Database(name);
|
||||
t.is(db.name,name);
|
||||
});
|
||||
|
||||
test("Statement.get() returns data", async (t) => {
|
||||
const [db] = await connect(":memory:");
|
||||
const stmt = db.prepare("SELECT 1");
|
||||
|
|
|
@ -10,6 +10,18 @@ test("Open in-memory database", async (t) => {
|
|||
t.is(db.memory, true);
|
||||
});
|
||||
|
||||
test("Property .name of in-memory database", async (t) => {
|
||||
let name = ":memory:";
|
||||
const db = new Database(name);
|
||||
t.is(db.name,name);
|
||||
});
|
||||
|
||||
test("Property .name of database", async (t) => {
|
||||
let name = "foobar.db";
|
||||
const db = new Database(name);
|
||||
t.is(db.name,name);
|
||||
});
|
||||
|
||||
test("Statement.get() returns data", async (t) => {
|
||||
const [db] = await connect(":memory:");
|
||||
const stmt = db.prepare("SELECT 1");
|
||||
|
|
|
@ -22,6 +22,11 @@ class Database {
|
|||
return db.inTransaction();
|
||||
},
|
||||
},
|
||||
name: {
|
||||
get() {
|
||||
return path;
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue