From 156c12b01798c8b5401272159e6d0ff98fa09304 Mon Sep 17 00:00:00 2001 From: "lancedb-gatefixer[bot]" <313497061+lancedb-gatefixer[bot]@users.noreply.github.com> Date: Sun, 1 Nov 2026 02:48:39 +0800 Subject: [PATCH] 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 --- nodejs/__test__/connection.test.ts | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/nodejs/__test__/connection.test.ts b/nodejs/__test__/connection.test.ts index 73f99803a..8691e9f16 100644 --- a/nodejs/__test__/connection.test.ts +++ b/nodejs/__test__/connection.test.ts @@ -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 }]);