@@ -10,11 +10,19 @@ const { classNameToMethodList } = require('../tools/api');
10
10
const { byStrings, sorted, runMicroTask } = require ( '../tools/utils' ) ;
11
11
12
12
// Dummy data to help with testing
13
- const iLoveJs = 'mongodb://iLoveJavascript' ;
14
- const client = new mongodbLegacy . MongoClient ( iLoveJs ) ;
15
- const db = new mongodbLegacy . Db ( client , 'animals' ) ;
16
- const collection = new mongodbLegacy . Collection ( db , 'pets' ) ;
17
- const namespace = MongoDBNamespace . fromString ( 'animals.pets' ) ;
13
+ let iLoveJs = 'mongodb://iLoveJavascript' ;
14
+ let client = new mongodbLegacy . MongoClient ( iLoveJs ) ;
15
+ let db = new mongodbLegacy . Db ( client , 'animals' ) ;
16
+ let collection = new mongodbLegacy . Collection ( db , 'pets' , { } ) ;
17
+ let namespace = MongoDBNamespace . fromString ( 'animals.pets' ) ;
18
+
19
+ function initialize ( ) {
20
+ iLoveJs = 'mongodb://iLoveJavascript' ;
21
+ client = new mongodbLegacy . MongoClient ( iLoveJs ) ;
22
+ db = new mongodbLegacy . Db ( client , 'animals' ) ;
23
+ collection = new mongodbLegacy . Collection ( db , 'pets' , { } ) ;
24
+ namespace = MongoDBNamespace . fromString ( 'animals.pets' ) ;
25
+ }
18
26
19
27
// A map to helpers that can create instances of the overridden classes for testing
20
28
const OVERRIDDEN_CLASSES_GETTER = new Map ( [
@@ -126,6 +134,9 @@ describe('wrapper API', () => {
126
134
possibleCallbackPositions,
127
135
makeStub
128
136
} of generateTests ( ) ) {
137
+
138
+ initialize ( ) ;
139
+
129
140
expect ( instance , apiName ) . to . have . property ( method ) . that . is . a ( 'function' ) ;
130
141
const functionLength = instance [ method ] . length ;
131
142
0 commit comments