File tree 3 files changed +37
-1
lines changed
3 files changed +37
-1
lines changed Original file line number Diff line number Diff line change
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
+ } ) ;
Original file line number Diff line number Diff line change
1
+ {
2
+ "name" : " mongodb" ,
3
+ "dependencies" : {
4
+ "mongodb" : " 6.0.0"
5
+ }
6
+ }
Original file line number Diff line number Diff line change 34
34
"undici" : " 5.20.0" ,
35
35
"vitest" : " 0.32.2" ,
36
36
"webpack" : " 5.88.0" ,
37
- "webpack-cli" : " 4.7.2"
37
+ "webpack-cli" : " 4.7.2" ,
38
+ "mongodb" : " 6.0.0"
38
39
},
39
40
"private" : true ,
40
41
"scripts" : {
You can’t perform that action at this time.
0 commit comments