test(nodejs): cover local object-form table creation across connections

## Summary

- add a regression test for object-form `createTable` on two independent local Node.js connections
- verify both connections use the same table name while preserving each database's rows

## Scope

This test covers the public local `connect(tmpDir)` path. It does not exercise LanceDB Cloud or remote create requests, and it does not establish a remote root cause or a complete fix for #952.

References #952
This commit is contained in:
lancedb-gatefixer[bot]
2026-11-01 02:48:39 +08:00
committed by GitHub
parent 0ecb4c8033
commit 156c12b017
+27
View File
@@ -158,6 +158,33 @@ describe("given a connection", () => {
await expect(tbl.countRows()).resolves.toBe(1);
});
it("should isolate local object-form table creation across connections", async () => {
const otherTmpDir = tmp.dirSync({ unsafeCleanup: true });
const otherDb = await connect(otherTmpDir.name);
try {
const firstTable = await db.createTable({
name: "defaultTable",
data: [{ rowId: "id1", vector: Array(384).fill(0) }],
});
const secondTable = await otherDb.createTable({
name: "defaultTable",
data: [{ rowId: "id2", vector: Array(384).fill(0) }],
});
await expect(db.tableNames()).resolves.toEqual(["defaultTable"]);
await expect(otherDb.tableNames()).resolves.toEqual(["defaultTable"]);
const firstRows = await firstTable.query().select(["rowId"]).toArray();
const secondRows = await secondTable.query().select(["rowId"]).toArray();
expect(firstRows.map((row) => row.rowId)).toEqual(["id1"]);
expect(secondRows.map((row) => row.rowId)).toEqual(["id2"]);
} finally {
otherDb.close();
otherTmpDir.removeCallback();
}
});
it("should be able to drop tables`", async () => {
await db.createTable("test", [{ id: 1 }, { id: 2 }]);
await db.createTable("test2", [{ id: 1 }, { id: 2 }]);