File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change 1+ import { expect } from "chai"
2+ import { MongoClient , OsAdapter } from "../../src"
3+ import * as os from 'os' ;
4+
5+ describe ( 'Runtime Adapters tests' , function ( ) {
6+ describe ( '`os`' , function ( ) {
7+ describe ( 'when no os adapter is provided' , function ( ) {
8+ it ( `defaults to Node's os module` , function ( ) {
9+ const client = new MongoClient ( 'mongodb://localhost:27017' ) ;
10+
11+ expect ( client . options . runtime . os ) . to . equal ( os ) ;
12+ } )
13+ } )
14+
15+ describe ( 'when an os adapter is provided' , function ( ) {
16+ it ( `uses the user provided adapter` , function ( ) {
17+ const osAdapter : OsAdapter = {
18+ ...os
19+ } ;
20+ const client = new MongoClient ( 'mongodb://localhost:27017' , {
21+ runtimeAdapters : {
22+ os : osAdapter
23+ }
24+ } ) ;
25+
26+ expect ( client . options . runtime . os ) . to . equal ( osAdapter ) ;
27+ } )
28+ } )
29+ } )
30+ } )
You can’t perform that action at this time.
0 commit comments