Skip to content

Commit 1bb67f0

Browse files
committed
add mongodb inspect test
1 parent c3fbad2 commit 1bb67f0

File tree

3 files changed

+37
-1
lines changed

3 files changed

+37
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import { test, expect, describe } from "bun:test";
2+
import { MongoClient } from "mongodb";
3+
4+
const CONNECTION_STRING = process.env.TLS_MONGODB_DATABASE_URL;
5+
6+
const it = CONNECTION_STRING ? test : test.skip;
7+
8+
describe("mongodb", () => {
9+
it("should connect and inpect", async () => {
10+
const client = new MongoClient(CONNECTION_STRING as string);
11+
12+
const clientConnection = await client.connect();
13+
14+
try {
15+
const db = client.db("oven");
16+
17+
const schema = db.collection("bun");
18+
19+
await schema.insertOne({ name: "bunny", version: 1.0 });
20+
const result = await schema.find();
21+
await schema.deleteOne({ name: "bunny" });
22+
const text = Bun.inspect(result);
23+
24+
expect(text).toBeDefined();
25+
} finally {
26+
await clientConnection.close();
27+
}
28+
});
29+
});
+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"name": "mongodb",
3+
"dependencies": {
4+
"mongodb": "6.0.0"
5+
}
6+
}

test/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@
3434
"undici": "5.20.0",
3535
"vitest": "0.32.2",
3636
"webpack": "5.88.0",
37-
"webpack-cli": "4.7.2"
37+
"webpack-cli": "4.7.2",
38+
"mongodb": "6.0.0"
3839
},
3940
"private": true,
4041
"scripts": {

0 commit comments

Comments
 (0)