@@ -172,7 +172,7 @@ test('libpq connection string building', function () {
172172 )
173173 } )
174174
175- test ( 'builds conn string with options' , function ( ) {
175+ test ( 'builds conn string with options and statement_timeout ' , function ( ) {
176176 var config = {
177177 user : 'brian' ,
178178 password : 'xyz' ,
@@ -181,13 +181,33 @@ test('libpq connection string building', function () {
181181 database : 'bam' ,
182182 statement_timeout : 5000 ,
183183 idle_in_transaction_session_timeout : 5000 ,
184+ options : '-c geqo=off -c foobar=off' ,
184185 }
185186 var subject = new ConnectionParameters ( config )
186187 subject . getLibpqConnectionString (
187188 assert . calls ( function ( err , constring ) {
188189 assert ( ! err )
189190 var parts = constring . split ( / (? = ( [ ^ \' ] * \' [ ^ \' ] * \' ) * [ ^ \' ] * $ ) / )
190- checkForPart ( parts , "options='-c statement_timeout=5000 -c idle_in_transaction_session_timeout=5000'" )
191+ checkForPart ( parts , "options='-c statement_timeout=5000 -c idle_in_transaction_session_timeout=5000 -c geqo=off -c foobar=off'" )
192+ } )
193+ )
194+ } )
195+
196+ test ( 'builds conn string with options and without statement_timeout' , function ( ) {
197+ var config = {
198+ user : 'brian' ,
199+ password : 'xyz' ,
200+ port : 888 ,
201+ host : 'localhost' ,
202+ database : 'bam' ,
203+ options : '-c geqo=off -c foobar=off' ,
204+ }
205+ var subject = new ConnectionParameters ( config )
206+ subject . getLibpqConnectionString (
207+ assert . calls ( function ( err , constring ) {
208+ assert ( ! err )
209+ var parts = constring . split ( / (? = ( [ ^ \' ] * \' [ ^ \' ] * \' ) * [ ^ \' ] * $ ) / )
210+ checkForPart ( parts , "options='-c geqo=off -c foobar=off'" )
191211 } )
192212 )
193213 } )
0 commit comments