( connectionString: string, uriOptions: Record<string, any>, clientOptions?: MongoClientOptions )
| 281 | }); |
| 282 | |
| 283 | function makeConnectionTest( |
| 284 | connectionString: string, |
| 285 | uriOptions: Record<string, any>, |
| 286 | clientOptions?: MongoClientOptions |
| 287 | ) { |
| 288 | const uri = new ConnectionString(connectionString); |
| 289 | for (const [k, v] of Object.entries(uriOptions)) { |
| 290 | uri.searchParams.set(k, v); |
| 291 | } |
| 292 | return async function () { |
| 293 | const client = new MongoClient(uri.toString(), clientOptions); |
| 294 | |
| 295 | await client.connect(); |
| 296 | await client.db('admin').command({ [LEGACY_HELLO_COMMAND]: 1 }); |
| 297 | await client.db('test').collection('test').findOne({}); |
| 298 | return await client.close(); |
| 299 | }; |
| 300 | } |
no test coverage detected