Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ describe("lbug", () => {
importTest("Data types", "./test_data_type.js");
importTest("Query parameters", "./test_parameter.js");
importTest("Concurrent query execution", "./test_concurrency.js");
importTest("Windows database paths", "./test_windows_path.js");
importTest("Version", "./test_version.js");
importTest("Synchronous API", "./test_sync_api.js");
});
38 changes: 38 additions & 0 deletions test/test_windows_path.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
if (process.platform === "win32" && !global.lbug) {
require("./common.js");
}

const itOnWindows = process.platform === "win32" ? it : it.skip;

itOnWindows("opens an on-disk database with a native absolute Windows path", async function () {
const fs = require("fs");
const path = require("path");

const testRoot = "C:\\adham\\lbug-test";
fs.rmSync(testRoot, { recursive: true, force: true });
fs.mkdirSync(testRoot, { recursive: true });
const dbPath = path.join(testRoot, "db_wasm_iso.lbug");
assert.include(dbPath, "\\");
assert.match(dbPath, /^C:\\/);

let db;
let conn;
try {
db = new lbug.Database(dbPath);
conn = new lbug.Connection(db);
await conn.query("CREATE NODE TABLE IF NOT EXISTS T(id STRING PRIMARY KEY)");
await conn.query("CREATE (:T {id: 'one'})");
const res = await conn.query("MATCH (t:T) RETURN t.id");
const rows = await res.getAll();
assert.deepEqual(rows, [{ "t.id": "one" }]);
res.close();
} finally {
if (conn) {
await conn.close();
}
if (db) {
await db.close();
}
fs.rmSync(testRoot, { recursive: true, force: true });
}
});
Loading