File tree Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -5,23 +5,27 @@ import MongoDBMemoryServer from '../MongoMemoryServer';
55
66jasmine . DEFAULT_TIMEOUT_INTERVAL = 60000 ;
77
8+ let con1 ;
9+ let con2 ;
810let db1 ;
911let db2 ;
1012let mongoServer1 ;
1113let mongoServer2 ;
1214beforeAll ( async ( ) => {
1315 mongoServer1 = new MongoDBMemoryServer ( ) ;
1416 const mongoUri = await mongoServer1 . getConnectionString ( ) ;
15- db1 = await MongoClient . connect ( mongoUri ) ;
17+ con1 = await MongoClient . connect ( mongoUri ) ;
18+ db1 = con1 . db ( await mongoServer1 . getDbName ( ) ) ;
1619
1720 mongoServer2 = new MongoDBMemoryServer ( ) ;
1821 const mongoUri2 = await mongoServer2 . getConnectionString ( ) ;
19- db2 = await MongoClient . connect ( mongoUri2 ) ;
22+ con2 = await MongoClient . connect ( mongoUri2 ) ;
23+ db2 = con2 . db ( await mongoServer1 . getDbName ( ) ) ;
2024} ) ;
2125
2226afterAll ( ( ) => {
23- db1 . close ( ) ;
24- db2 . close ( ) ;
27+ con1 . close ( ) ;
28+ con2 . close ( ) ;
2529 mongoServer1 . stop ( ) ;
2630 mongoServer2 . stop ( ) ;
2731} ) ;
Original file line number Diff line number Diff line change @@ -5,16 +5,18 @@ import MongoDBMemoryServer from '../MongoMemoryServer';
55
66jasmine . DEFAULT_TIMEOUT_INTERVAL = 60000 ;
77
8+ let con ;
89let db ;
910let mongoServer ;
1011beforeAll ( async ( ) => {
1112 mongoServer = new MongoDBMemoryServer ( ) ;
1213 const mongoUri = await mongoServer . getConnectionString ( ) ;
13- db = await MongoClient . connect ( mongoUri ) ;
14+ con = await MongoClient . connect ( mongoUri ) ;
15+ db = con . db ( await mongoServer . getDbName ( ) ) ;
1416} ) ;
1517
1618afterAll ( ( ) => {
17- db . close ( ) ;
19+ con . close ( ) ;
1820 mongoServer . stop ( ) ;
1921} ) ;
2022
You can’t perform that action at this time.
0 commit comments