File tree 3 files changed +15
-2
lines changed
3 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -2,10 +2,11 @@ var genericPool = require('generic-pool')
2
2
var util = require ( 'util' )
3
3
var EventEmitter = require ( 'events' ) . EventEmitter
4
4
var debug = require ( 'debug' )
5
+ var objectAssign = require ( 'object-assign' )
5
6
6
7
var Pool = module . exports = function ( options , Client ) {
7
8
EventEmitter . call ( this )
8
- this . options = options || { }
9
+ this . options = objectAssign ( { } , options )
9
10
this . log = this . options . log || debug ( 'pg:pool' )
10
11
this . Client = this . options . Client || Client || require ( 'pg' ) . Client
11
12
this . Promise = this . options . Promise || Promise
Original file line number Diff line number Diff line change 37
37
},
38
38
"dependencies" : {
39
39
"debug" : " ^2.2.0" ,
40
- "generic-pool" : " 2.4.2"
40
+ "generic-pool" : " 2.4.2" ,
41
+ "object-assign" : " 4.1.0"
41
42
}
42
43
}
Original file line number Diff line number Diff line change @@ -51,6 +51,17 @@ describe('pool', function () {
51
51
} )
52
52
} )
53
53
} )
54
+
55
+ it ( 'should not change given options' , function ( done ) {
56
+ var options = { max : 10 }
57
+ var pool = new Pool ( options )
58
+ pool . connect ( function ( err , client , release ) {
59
+ release ( )
60
+ if ( err ) return done ( err )
61
+ expect ( options ) . to . eql ( { max : 10 } )
62
+ pool . end ( done )
63
+ } )
64
+ } )
54
65
} )
55
66
56
67
describe ( 'with promises' , function ( ) {
You can’t perform that action at this time.
0 commit comments