@@ -54,7 +54,10 @@ describe('Hapi server', () => {
5454 await server . register ( {
5555 plugin : require ( '../' ) ,
5656 options : {
57- url : 'mongodb://localhost:27018'
57+ url : 'mongodb://localhost:27018' ,
58+ settings : {
59+ serverSelectionTimeoutMS : 500
60+ }
5861 }
5962 } ) ;
6063 }
@@ -97,7 +100,7 @@ describe('Hapi server', () => {
97100 } ) ;
98101 } ) ;
99102
100- it ( 'should log configuration upon successfull connection, obscurifying DB password' , async ( ) => {
103+ it ( 'should log configuration upon successful connection, obscurifying DB password' , async ( ) => {
101104
102105 let logEntry ;
103106 server . events . once ( 'log' , ( entry ) => {
@@ -111,7 +114,7 @@ describe('Hapi server', () => {
111114
112115 Mongodb . MongoClient . connect = originalConnect ;
113116 expect ( url ) . to . equal ( 'mongodb://user:[email protected] :27017' ) ; 114- expect ( options ) . to . equal ( { poolSize : 11 } ) ;
117+ expect ( options ) . to . equal ( { maxPoolSize : 11 } ) ;
115118 connected = true ;
116119 return Promise . resolve ( { db : ( ) => 'test-db' } ) ;
117120 } ;
@@ -121,7 +124,7 @@ describe('Hapi server', () => {
121124 options : {
122125 url :
'mongodb://user:[email protected] :27017' , 123126 settings : {
124- poolSize : 11
127+ maxPoolSize : 11
125128 }
126129 }
127130 } ) ;
@@ -131,7 +134,7 @@ describe('Hapi server', () => {
131134 channel : 'app' ,
132135 timestamp : logEntry . timestamp ,
133136 tags : [ 'hapi-mongodb' , 'info' ] ,
134- data : 'MongoClient connection created for {"url":"mongodb://user:******@example.com:27017","settings":{"poolSize ":11}}'
137+ data : 'MongoClient connection created for {"url":"mongodb://user:******@example.com:27017","settings":{"maxPoolSize ":11}}'
135138 } ) ;
136139 } ) ;
137140
@@ -142,7 +145,7 @@ describe('Hapi server', () => {
142145 options : {
143146 url : 'mongodb://localhost:27017' ,
144147 settings : {
145- poolSize : 10
148+ maxPoolSize : 10
146149 }
147150 }
148151 } ) ;
@@ -320,12 +323,12 @@ describe('Hapi server', () => {
320323
321324 await server . initialize ( ) ;
322325
323- expect ( server . plugins [ 'hapi-mongodb' ] . client . isConnected ( ) ) . to . be . true ( ) ;
326+ expect ( server . plugins [ 'hapi-mongodb' ] . client . topology . isConnected ( ) ) . to . be . true ( ) ;
324327
325328 await server . stop ( ) ;
326329 await Hoek . wait ( 100 ) ; // Let the connections end.
327330
328- expect ( server . plugins [ 'hapi-mongodb' ] . client . isConnected ( ) ) . to . be . false ( ) ;
331+ expect ( server . plugins [ 'hapi-mongodb' ] . client . topology ) . to . be . undefined ( ) ;
329332 } ) ;
330333
331334 it ( 'should logs errors on disconnect' , async ( ) => {
@@ -342,7 +345,7 @@ describe('Hapi server', () => {
342345
343346 await server . initialize ( ) ;
344347
345- expect ( server . plugins [ 'hapi-mongodb' ] . client . isConnected ( ) ) . to . be . true ( ) ;
348+ expect ( server . plugins [ 'hapi-mongodb' ] . client . topology . isConnected ( ) ) . to . be . true ( ) ;
346349 const closeStub = Sinon . stub ( server . plugins [ 'hapi-mongodb' ] . client , 'close' ) . callsFake ( ( cb ) => {
347350
348351 setTimeout ( cb , 0 , new Error ( 'Oops' ) ) ;
0 commit comments