aboutsummaryrefslogtreecommitdiff
path: root/test/bun.js/sqlite.test.js
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-01-22 19:09:52 -0800
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-01-22 19:09:52 -0800
commit349224869751c9d74540d5de75bf0681c69dd45d (patch)
tree7dc7f48a085a217f187b80a445b351a7e4f332eb /test/bun.js/sqlite.test.js
parentbc7192dca1c9da8714f72be3848100e9d16a5425 (diff)
downloadbun-349224869751c9d74540d5de75bf0681c69dd45d.tar.gz
bun-349224869751c9d74540d5de75bf0681c69dd45d.tar.zst
bun-349224869751c9d74540d5de75bf0681c69dd45d.zip
Fixes #1366
Diffstat (limited to 'test/bun.js/sqlite.test.js')
-rw-r--r--test/bun.js/sqlite.test.js26
1 files changed, 25 insertions, 1 deletions
diff --git a/test/bun.js/sqlite.test.js b/test/bun.js/sqlite.test.js
index e5f83fe4d..f78d3b481 100644
--- a/test/bun.js/sqlite.test.js
+++ b/test/bun.js/sqlite.test.js
@@ -1,6 +1,9 @@
import { expect, it, describe } from "bun:test";
import { Database, constants } from "bun:sqlite";
-import { existsSync, fstat, writeFileSync } from "fs";
+import { existsSync, fstat, realpathSync, rmSync, writeFileSync } from "fs";
+import { spawnSync } from "bun";
+import { bunExe } from "bunExe";
+import { tmpdir } from "os";
var encode = (text) => new TextEncoder().encode(text);
it("Database.open", () => {
@@ -55,6 +58,27 @@ it("Database.open", () => {
new Database().close();
});
+it("upsert cross-process, see #1366", () => {
+ const dir = realpathSync(tmpdir()) + "/";
+ const { exitCode } = spawnSync(
+ [bunExe(), import.meta.dir + "/sqlite-cross-process.js"],
+ {
+ env: {
+ SQLITE_DIR: dir,
+ },
+ stderr: "inherit",
+ },
+ );
+ expect(exitCode).toBe(0);
+
+ const db2 = Database.open(dir + "get-persist.sqlite");
+
+ expect(db2.query(`SELECT id FROM examples`).all()).toEqual([
+ { id: "hello" },
+ { id: "world" },
+ ]);
+});
+
it("creates", () => {
const db = Database.open(":memory:");
db.exec(