aboutsummaryrefslogtreecommitdiff
path: root/test/js/third_party/mongodb/mongodb.test.ts
diff options
context:
space:
mode:
authorGravatar Dylan Conway <dylan.conway567@gmail.com> 2023-10-17 14:10:25 -0700
committerGravatar Dylan Conway <dylan.conway567@gmail.com> 2023-10-17 14:10:25 -0700
commit7458b969c5d9971e89d187b687e1924e78da427e (patch)
treeee3dbf95c728cf407bf49a27826b541e9264a8bd /test/js/third_party/mongodb/mongodb.test.ts
parentd4a2c29131ec154f5e4db897d4deedab2002cbc4 (diff)
parente91436e5248d947b50f90b4a7402690be8a41f39 (diff)
downloadbun-7458b969c5d9971e89d187b687e1924e78da427e.tar.gz
bun-7458b969c5d9971e89d187b687e1924e78da427e.tar.zst
bun-7458b969c5d9971e89d187b687e1924e78da427e.zip
Merge branch 'main' into postinstall_3
Diffstat (limited to 'test/js/third_party/mongodb/mongodb.test.ts')
-rw-r--r--test/js/third_party/mongodb/mongodb.test.ts29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/js/third_party/mongodb/mongodb.test.ts b/test/js/third_party/mongodb/mongodb.test.ts
new file mode 100644
index 000000000..da0a089cf
--- /dev/null
+++ b/test/js/third_party/mongodb/mongodb.test.ts
@@ -0,0 +1,29 @@
+import { test, expect, describe } from "bun:test";
+import { MongoClient } from "mongodb";
+
+const CONNECTION_STRING = process.env.TLS_MONGODB_DATABASE_URL;
+
+const it = CONNECTION_STRING ? test : test.skip;
+
+describe("mongodb", () => {
+ it("should connect and inpect", async () => {
+ const client = new MongoClient(CONNECTION_STRING as string);
+
+ const clientConnection = await client.connect();
+
+ try {
+ const db = client.db("bun");
+
+ const schema = db.collection("bun");
+
+ await schema.insertOne({ name: "bunny", version: 1.0 });
+ const result = await schema.find();
+ await schema.deleteOne({ name: "bunny" });
+ const text = Bun.inspect(result);
+
+ expect(text).toBeDefined();
+ } finally {
+ await clientConnection.close();
+ }
+ });
+});